Monday, April 23, 2012

Re: [ns] bash file for ns2

Hello

In order to pass your desired simulation values as function parameters from
a bash script, you should do it this way:

#!/bin/bash

#stuff....

#call the simulator

./ns Source.tcl argx0 argx1 argx2 etc

in the bash file
and in the tcl file

set var1 [lindex $argv 0]
set var2 [lindex $argv 1]
set var3 [lindex $argv 2]
set etc [lindex $argv 3]

and so on. var1 corresponds to argx0 by doing this. Now, to pass a bash
variable to the script I suggest that you search for a bash tutorial. It is
an easy thing to do, and very useful.

Best Regards,

Israel Herrera.


2012/4/23 mbasitrizvi <mbasitrizvi@yahoo.com>

>
>
> Hey guys...my question is more linux related and less ns2 related. Im
> using a
> ns2 script which has a bash file.
>
> i have a tcl file.... simulation1.tcl
>
> and then there is a bash file called... bash_script_for_simulation1
>
> in the bash file i set parameters like:
> ...
> number_of_tcp_connections=1
> number_of_udp_connection=3
> global_delay=40
> random_num_gen_seed=1
> time=50
> ...
>
> Now how do I tell simulation1.tcl to use the bash file to run.
>
> Simply typing
> #ns simulation1.tcl
> doesnt work. It doesnt read the values it is supposed to from the bash file
> this way.
>
>
>
> --
> View this message in context:
> http://old.nabble.com/bash-file-for-ns2-tp33734197p33734197.html
> Sent from the ns-users mailing list archive at Nabble.com.
>
>

No comments:

Post a Comment

Counter

blogger analytics