I have server list in file and in a while loop I will read and runt he command using ssh. it displays only last server uptime output. other servers its not displaying.
eg:
cat a
host1
host2
cat a | while read s; do ssh -q $s -x "uptime"; done
it shows only host2 uptime output.
we changed to run like this it displays both servers output
cat a | while read s; do echo "ssh -q $s -x uptime"|bash; done
I like to understand, why we need while read loop displaying only last output.
Is anyother way we can execute the ssh remote command using while loop?
Thanks SR