The loop repeats only once with `ssh` in the body
1 answer
sshalso reads from standard input, so the first call sshconsumes the remainder argument_list.txtbefore the next call read. To fix, either redirect sshstandard input from /dev/null, using either
ssh somehost "command $line" < /dev/stdin
or
ssh -n somehost "command $line"
, ssh , , argument_list.txt. while.
while read -r line <&3; do
ssh somehost "command $line"
done 3< argument_list.txt
bash, read -u, , .
while read -r -u 3 line; do
ssh somehost "command $line"
done 3< argument_list.txt
+5