我有这个简单的bash脚本: 我运行ns模拟器在每个文件传递参数最后一个参数是一些文本字符串搜索。Bash脚本:不需要的输出
#!/bin/bash
nsloc="/home/ashish/ns-allinone-2.35/ns-2.35/ns"
temp="temp12345ashish.temp"
j=1
for file in "[email protected]"
do
if [ $j -lt $# ]
then
let j=$j+1
`$nsloc $file > $temp 2>&1`
if grep -l ${BASH_ARGV[0]} $temp
then
echo "$file Successful"
fi
fi
done
我预计:
file1.tcl Successful
我越来越:
temp12345ashish.temp
file1.tcl Successful
当我在终端上运行模拟器命令自己,我没有得到其输出指向的文件名。
我没有从第一行输出得到打印。 请解释一下。
在此先感谢。