ns3中路由协议仿真的shell脚本编写
2016-04-18 20:47
609 查看
ns3中的路由协议仿真,需要进行多次,而每一次仿真所要修改的地方很少,而且可以用循环实现。
于是乎,就想到了利用shell进行批处理。写好脚本,就可以一劳永逸,不用管就可以生成多组仿真了,简直太棒了!
先扔上代码,其实非常简单。
#!bin/bsah
cd /home/doris/soft/ns-allinone-3.23/ns-3.23
count=70
for((a=50;a<count;a+=10))
do
echo "nodes=$a">>vanet.txt
./waf --run "vanet-routing-compare --totaltime=100 --nodes=$a txp=10 --traceFile=src/wave/examples/scenario/n$a.tcl --scenario=2">>vanet.txt
done
exit
!注意:1、./waf执行文件,只有在/home/doris/soft/ns-allinone-3.23/ns-3.23下才可执行,所以要进入该目录。
2、此时已经进入以上目录,那么生成的vanet.txt也是在该目录下。
3、for循环一定要双括号。
于是乎,就想到了利用shell进行批处理。写好脚本,就可以一劳永逸,不用管就可以生成多组仿真了,简直太棒了!
先扔上代码,其实非常简单。
#!bin/bsah
cd /home/doris/soft/ns-allinone-3.23/ns-3.23
count=70
for((a=50;a<count;a+=10))
do
echo "nodes=$a">>vanet.txt
./waf --run "vanet-routing-compare --totaltime=100 --nodes=$a txp=10 --traceFile=src/wave/examples/scenario/n$a.tcl --scenario=2">>vanet.txt
done
exit
!注意:1、./waf执行文件,只有在/home/doris/soft/ns-allinone-3.23/ns-3.23下才可执行,所以要进入该目录。
2、此时已经进入以上目录,那么生成的vanet.txt也是在该目录下。
3、for循环一定要双括号。
相关文章推荐
- shell中的IFS和$*变量
- 在secureCRT中解决hbase spark shell退格不能删除问题
- shell并发处理脚本
- shell脚本之sed使用详解
- shell脚本之grep使用详解
- adb shell 命令
- SHELL syntax error:unexpected end of file 提示错误
- 关于adb logcat
- shell下的进程
- 解决bash: mysql: command not found 的方法
- linux shell实现 URL 编码/解码方法
- linux shell 字符串操作(长度,查找,替换)详解
- 基于CentOS的MySQL学习补充三--使用Shell批量创建数据库表
- xshell的快捷键(非常实用)
- 使用zsh的十大优点
- shell的wc命令统计 head tail命令详解
- shell echo颜色例子
- 文件同步rsync
- easyshell 安装
- [原创]-bash: iostat: command not found解决办法