script to read a file with IP addresses and login
问题 I have a file named "host.txt" with listing IP addresses of two systems. ~] cat hosts.txt 10.1.1.10 10.1.1.20 Using below script I am trying to login to each system, check status of a service and print the output of each system. The script prompts to login, however does not continue to execute the /opt/agent.sh status command. Can someone please help fix this script? #!/bin/bash for HOST in `cat hosts.txt` do ssh root@$HOST STATUS=`/opt/agent.sh status | awk 'NR==1{print $3 $4}'` echo $STATUS