linux终端中依次输入2条命令:
sed -i "s/`cat TBCxiug.dat |awk '{print $2 }'|awk 'NR==74{print}'`/`cat a.txt |awk '{print $2 }'|awk 'NR==1{print}'`/g" TBCxiug.dat
/opt/software/.../nessus /opt/software/.../license.txt /home/.../TBCxiug probabilistic verbose z
能执行并得到相应结果(不要关注第二条命令,它是调用名为nessus的软件计算一个案例)我把上面2条命令写入file.txt,
#!/bin/sh
sed -i "s/`cat TBCxiug.dat |awk '{print $2 }'|awk 'NR==74{print}'`/`cat a.txt |awk '{print $2 }'|awk 'NR==1{print}'`/g" TBCxiug.dat
/opt/software/.../nessus /opt/software/.../license.txt /home/.../TBCxiug probabilistic verbose z并chmod +x file.txt 变成可执行后, ./file.txt运行后,报错如下:
/opt/software/NESSUS-9.5/bin/Linux/nessus: No such file or directory
sed: can't read /home/xiaoyq/Desktop/NESSUS_Temp/TBCxiug: No such file or directory
sed: can't read probabilistic: No such file or directory
sed: can't read verbose: No such file or directory
sed: can't read z: No such file or directory
求分析原因,求解决