1、ns2法 ns test.tcl 2、 vim test.tcl进入文件; 然后在第一行添加: #!/usr/bin/env tclsh 保存退出; 把文件变成可执行的,chmod +x test.tcl 然后直接运行 ./test.tcl 即可