I have tried to ssh to multiple vms. I used for loop. I want to fetch the username and IP and loop into multiple VMs.
export IFS=","
for read f1 f2 in $(cat sample.txt);
do sshpass -p 'password' ssh $f1@$f2 "uname -a" ;
done
sample.txt contains
abc,111.111.111.111
def,111.222.333.444
Looks like I am facing an error,
syntax error near unexpected token f1'
for read f1 f2 in $(cat LNodeInput.txt);'
I have tried it in few other ways too but still throws an error.
fordoesn't work that way, change towhileand you'll be very close. Good luck.