Skip to main content
added 202 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398

You should use while, not for. The way to avoid commands swallowing standard input in such a loop is simply to use another file descriptor:

while read -u 9 server; do
  ssh $server "uname -a"
done 9< /home/kenny/list_of_servers.txt

For more information, help [r]ead (really) and another article explaining why.

You should use while, not for. The way to avoid commands swallowing standard input in such a loop is simply to use another file descriptor:

while read -u 9 server; do
  ssh $server "uname -a"
done 9< /home/kenny/list_of_servers.txt

You should use while, not for. The way to avoid commands swallowing standard input in such a loop is simply to use another file descriptor:

while read -u 9 server; do
  ssh $server "uname -a"
done 9< /home/kenny/list_of_servers.txt

For more information, help [r]ead (really) and another article explaining why.

added 57 characters in body
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398

You should use while, not for. The way to avoid commands swallowing standard input in such a loop is simply to use another file descriptorfile descriptor:

while read -u 9 server; do
  ssh $server "uname -a"
done 9< /home/kenny/list_of_servers.txt

You should use while, not for. The way to avoid commands swallowing standard input in such a loop is simply to use another file descriptor:

while read -u 9 server; do
  ssh $server "uname -a"
done 9< /home/kenny/list_of_servers.txt

You should use while, not for. The way to avoid commands swallowing standard input in such a loop is simply to use another file descriptor:

while read -u 9 server; do
  ssh $server "uname -a"
done 9< /home/kenny/list_of_servers.txt
Source Link
l0b0
  • 53.6k
  • 48
  • 225
  • 398

You should use while, not for. The way to avoid commands swallowing standard input in such a loop is simply to use another file descriptor:

while read -u 9 server; do
  ssh $server "uname -a"
done 9< /home/kenny/list_of_servers.txt