fork download
  1. set ns [new Simulator]
  2. set namfile [open out.nam new]
  3. $ns nametrace-all $namfile
  4. set tracfile [open out.tr w]
  5. %ns trace-all $tracefile
  6.  
  7. proc finish { } {
  8. global ns namfile tracfile
  9. $ns flush-trace
  10. close $namfile
  11. close $tracefile
  12. exec nam out.nam &
  13. exit 0
  14. }
  15.  
  16. set n0[$ns node]
  17. set n1[$ns node]
  18. $ns duplex-link $n0 $n1 10Mb 10ms DropTail
  19.  
  20. $ns at 5.0 "finish"
  21. $ns run
Success #stdin #stdout #stderr 0.01s 5280KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
./prog.sh: line 3: nametrace-all: command not found
./prog.sh: line 5: fg: no job control
./prog.sh: line 7: proc: command not found
./prog.sh: line 8: global: command not found
./prog.sh: line 9: flush-trace: command not found
./prog.sh: line 10: close: command not found
./prog.sh: line 11: close: command not found
./prog.sh: line 12: exec: nam: not found