I am trying to pass login details to different machines through ssh in a shell script. Even though I have used a for loop, I am ending up sending all the login information to all the machines. Can someone please help me with this?
for system in ${allSystems}
do
machine=`echo $system | awk -F ";" '{print $1}'`
username=`echo $system | awk -F ";" '{print $2}'`
password=`echo $system | awk -F ";" '{print $3}'`
echo "$machine;$username;$password" | ssh $machine 'cat >> loginDetails.txt'
done
An example $system would contain:
abcde.unix.system.edu;username;password
Thank you.