[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
ssh inside a loop problem
From: |
caudio |
Subject: |
ssh inside a loop problem |
Date: |
Fri, 5 Oct 2007 10:25:26 -0700 (PDT) |
Hi everybody! I have recently had a problem trying to make an ssh runn
inside a loop.
Basically what im trying to do is to make the script read the first server
on "SERVER_FILE" and do an ssh connection to that server, then inside that
server execute another loop and read the first user from $USERS_FILE and
remove that user.
The script is connecting fine but is giving me this error when it tries to
perform the second loop..
ksh[4]: syntax error at line 5 : `user2' unexpected
All the task on Server:server1 has been completed :D
It seems that it is reading the second user on $USERS_FILE and not the first
one as the format of USERS_FILE is:
user1
user2
user3
but i dont know why..
If I remove the ssh and run the 2 loops together locally, everything goes
perfect!
I will really appreciate any suggestions!
Thanks in advance!!!
Below are the 2 loops that im using..
for s in $(cat $SERVER_FILE);
do
ssh $s "
PATH=$PATH:/usr/local/bin:/usr/local/sbin:/usr/sbin:/usr/lbin:/usr/local/etc;
for i in $(cat $USERS_FILE);
do
echo $i >> $HOME/line ||touch $HOME/line
line=$(sed -e 's/_/ /g' $HOME/line)
NetworkId=$(echo "$line");
rm -r $HOME/line
sudo userdel -r $NetworkId
echo "All the task on Server:$s has been completed :D"
done
exit "
done
--
View this message in context:
http://www.nabble.com/ssh-inside-a-loop-problem-tf4576640.html#a13063996
Sent from the Gnu - Bash mailing list archive at Nabble.com.
- ssh inside a loop problem,
caudio <=