[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] How to make script work in order ?



Hello,

I have a question in " How to make processes work in order ";
when I run a simulation, I want to have a trace-queue for every period of
time (line 1~3),
and at the very end of this period, I'll use "awk" to filt some information
into a file 'result' (line 4)
then get the 'result' data for the next period (line 5).

But however, at 9.9 second, the file 'result' is not completed yet,
so I could not open it.

What should I do to make "line 5" be executed after "line 4" is completed ?

Thanks a lot !!

1._        set file [open queue.tr w]
2._        $ns at 0.0 "$ns trace-queue $n3 $n4 $file"
3._        $ns at 9.0 "close $file"
4._        $ns at 9.5 "exec awk -f count.awk queue.tr > result
5._        $ns at 9.9 "set tmp [open result r]; read $tmp"