I want to do SSH on many different machines and then run some commands on them. A binary application randomly generates IP addresses and my script will take care of doing SSH.
$ ./IPGen.exe | ./myScript.sh
my script looks like this:
while read line; do
result1=$(ssh $line 'LinuxCommand1') &
result2=$(ssh $line 'LinuxCommand2') &
result3=$(ssh $line 'LinuxCommand3') &
echo "$result1 - $result2 - $result3";
The problems are:
1- The while loop ends after first round!!!
2- All variables (result1, result2, result3) are empty.
I tried to search the forum before posting but I really didn't know what should I search for?!