SSH connection inside while Bash loop
When using SSH connection inside while Bash loop, there is need to redirect SSH input to /dev/null, as SSH reads standard input by default: #!/bin/bash while read IP; do echo $IP; ssh root@$IP -C hostname < /dev/null; echo "" done < ip.txt Contnet of ip.txt file: 192.168.0.10 192.168.0.11 192.168.0.12