title: Passing command line arguement in tcl script in NS2
body: <p>I want to create topology through command line argument. I passed the node number in command line argument. Here is my command </p>
  
  <pre><code>ns sat-wired2.tcl 30
  </code></pre>
  
  <p>And here is tcl script fragment</p>
  
  <pre><code>set var [lindex $argv 1]
  for {set i 0} {$i &lt; $var } {incr i} {
    $ns duplex-link $n($i) $n([($i+1)]) 1Mb 2ms DropTail
  }
  
  $ns duplex-link $n($var) $n1 1Mb 10ms DropTail
  </code></pre>
  
  <p>Here is my output </p>
  
  <pre><code> no such variable
      while executing
  "$ns duplex-link $n($var) $n1 1Mb 10ms DropTail"
      (file "sat-wired2.tcl" line 109)
  </code></pre>
  
  <p>I'm noob in both tcl and NS2. Somebody please help me.</p>