Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # Rodolfo Oliveira - LabTele
- #
- ##########################################################################################
- ##########################################################################################
- ##########################################################################################
- ##########################################################################################
- ## number of nodes
- nodes[1]=10
- nodes[2]=20
- nodes[3]=30
- nodes[4]=40
- nodes[5]=50
- ## routing protocol
- rp[1]='AODV'
- rp[20]='DSDV'
- rp[30]='DSR'
- rp[40]='OLSR'
- # velocities
- vel[1]=0
- vel[2]=1
- vel[3]=2
- vel[4]=10
- vel[5]=28
- # seeds
- seeds[1]=46279
- seeds[2]=46280
- seeds[3]=46281
- seeds[4]=46282
- seeds[5]=46283
- # MCorrente Crucial Commentary
- ##############################
- # Commands:
- # rm file Remove file or folder
- # cat file1 > file2 Read from file1 and > output to file2
- # awk Evaluate sentence or string and execute, allowing the execution of commands
- # | Pipe - Used to chain commands - The output of a command is the input of the next
- # echo Print to console
- # write script files
- rm run_*
- echo "start"
- for i_rp in 1 20 30 40
- do
- for i_vel in 1 2 3 4 5
- do
- for i_node in 1 2 3 4 5 # Five lines.
- do
- for i_seed in 1 2 3 4 5
- do
- cat my_first_routing_script.tcl |
- awk '{ if ($1 == "set" && $2 == "val(nn)") print $1, $2, '${nodes[i_node]}'";"; else print }' |
- awk '{ if ($1 == "set" && $2 == "val(vel)") print $1, $2, '${vel[i_vel]}'";"; else print }' |
- awk '{ if ($1 == "set" && $2 == "val(semente)") print $1, $2, '${seeds[i_seed]}'";"; else print }' |
- 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"
- ## escreve no ficheiro run_xx
- echo "ns script_"${rp[i_rp]}"_n"${nodes[i_node]}"_v"${vel[i_vel]}"_s"${seeds[i_seed]}".tcl" >> aux
- done #End of i_seed
- done # End of i_node
- done # End of i_vel
- echo "${rp[i_rp]}"
- cat aux >> "run_"${rp[i_rp]}
- rm aux
- chmod +x run_*
- done # End of i_rp
- echo "end"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement