如何 运行 变量中的文件
How to run a file in variable
我想要运行这个命令:
././pscan `cat ips` 22
但脚本不运行 corectly
ips file:
1.1
2.2
3.3
4.4
5.5
我想运行命令例如:
././pscan 1.1 22
././pscan 2.2 22
././pscan 3.3 22
././pscan 4.4 22
././pscan 5.5 22
脚本 pscan
在我输入单个命令时完美运行 ././pscan 1.1 22
我想 运行 超过 5.5,例如 100.241 等等。
您要 运行 您的命令与每个 line/word 输入吗?您可以使用循环和 read
来实现:
while read line; do
./script.sh "$line" other args
done < input_file
或 xargs
:
< input_file xargs -L1 -I{} ./script {} other args
注意(不)处理空格的方式。
我想要运行这个命令:
././pscan `cat ips` 22
但脚本不运行 corectly
ips file:
1.1
2.2
3.3
4.4
5.5
我想运行命令例如:
././pscan 1.1 22
././pscan 2.2 22
././pscan 3.3 22
././pscan 4.4 22
././pscan 5.5 22
脚本 pscan
在我输入单个命令时完美运行 ././pscan 1.1 22
我想 运行 超过 5.5,例如 100.241 等等。
您要 运行 您的命令与每个 line/word 输入吗?您可以使用循环和 read
来实现:
while read line; do
./script.sh "$line" other args
done < input_file
或 xargs
:
< input_file xargs -L1 -I{} ./script {} other args
注意(不)处理空格的方式。