Hello,
I am trying to login to multiple servers and i have to run multiple loops to gather some details..Could you please help me out.
I am specifically facing issues while running for loops.
I have to run multiple for loops in else condition. but the below code is giving errors in for loop.
while read LINE
do
srv="$(echo $LINE | awk '{print $1}')"
ssh $srv '/bin/bash -s' << EOF
if [ -d /home/mvardha ]
then
echo " directory already exist , exiting"
else
echo " directory not exist "
'for i in $( ls -ltr /var/log/messages* | awk "{ print \$9 }" ) ; do echo $i ; done'
fi
EOF
done < /home/mvardhan/serverlist
Thanks in advance!