Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Rodolfo Oliveira - LabTele
  4. #
  5. ##########################################################################################
  6. ##########################################################################################
  7. ##########################################################################################
  8. ##########################################################################################
  9.  
  10. ## number of nodes
  11. nodes[1]=10
  12. nodes[2]=20
  13. nodes[3]=30
  14. nodes[4]=40
  15. nodes[5]=50
  16.  
  17. ## routing protocol
  18. rp[1]='AODV'
  19. rp[20]='DSDV'
  20. rp[30]='DSR'
  21. rp[40]='OLSR'
  22.  
  23. # velocities
  24. vel[1]=0
  25. vel[2]=1
  26. vel[3]=2
  27. vel[4]=10
  28. vel[5]=28
  29.  
  30. # seeds
  31. seeds[1]=46279
  32. seeds[2]=46280
  33. seeds[3]=46281
  34. seeds[4]=46282
  35. seeds[5]=46283
  36.  
  37. # MCorrente Crucial Commentary
  38. ##############################
  39. # Commands:
  40. # rm file Remove file or folder
  41. # cat file1 > file2 Read from file1 and > output to file2
  42. # awk Evaluate sentence or string and execute, allowing the execution of commands
  43. # | Pipe - Used to chain commands - The output of a command is the input of the next
  44. # echo Print to console
  45.  
  46.  
  47. # write script files
  48. rm run_*
  49. echo "start"
  50. for i_rp in 1 20 30 40
  51. do
  52. for i_vel in 1 2 3 4 5
  53. do
  54. for i_node in 1 2 3 4 5 # Five lines.
  55. do
  56. for i_seed in 1 2 3 4 5
  57. do
  58. cat my_first_routing_script.tcl |
  59. awk '{ if ($1 == "set" && $2 == "val(nn)") print $1, $2, '${nodes[i_node]}'";"; else print }' |
  60. awk '{ if ($1 == "set" && $2 == "val(vel)") print $1, $2, '${vel[i_vel]}'";"; else print }' |
  61. awk '{ if ($1 == "set" && $2 == "val(semente)") print $1, $2, '${seeds[i_seed]}'";"; else print }' |
  62. awk '{ if ($1 == "set" && $2 == "val(rp)") print $1, $2, "'${rp[i_rp]}';"; else print }'> "script_"${rp[i_rp]}"_n"${nodes[i_node]}"_v"${vel[i_vel]}"_s"${seeds[i_seed]}".tcl"
  63. ## escreve no ficheiro run_xx
  64. echo "ns script_"${rp[i_rp]}"_n"${nodes[i_node]}"_v"${vel[i_vel]}"_s"${seeds[i_seed]}".tcl" >> aux
  65. done #End of i_seed
  66. done # End of i_node
  67. done # End of i_vel
  68. echo "${rp[i_rp]}"
  69. cat aux >> "run_"${rp[i_rp]}
  70. rm aux
  71. chmod +x run_*
  72. done # End of i_rp
  73. echo "end"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement