bash脚本提交后台运行
For example, I want to spawn many ssh background processes in one bash script:
for i in `cat ./all-hosts`
do
ssh $i "ifconfig | grep Link"
done
Simply adding a &
to the ssh commands does not work.
只是在ssh命令中添加&
无效。
Here is the script that works:
这是起作用的脚本:
for i in `cat ./all-hosts`
do
ssh $i "ifconfig | grep Link" &
done
Or in one comman