help on if loop within ssh

From: Kumaresh P Nataraj (pnkumaresh@in.ibm.com)
Date: Thu Sep 21 2006 - 21:13:26 EDT


Thanks to all replied .... Finally got it

for i in `cat sev_list`
do
        echo "$i ---Started"
        ssh root@$i "/usr/sbin/useradd -u 10536 -c \"Oleg
Kokotovic/Australia/Contr/IBM@IBMAU\" -d /export/home/oko01 -m -s /bin/ksh
oko01[ \
                /usr/bin/passwd.orig oko01; else\
                /usr/bin/passwd oko01; fi"
        echo "$i --Finished"
done

here oko01 is userid ...
and got a error permission denied for running passwd command ... is that
true that we cant exceute passwd with ssh ?

Best Regards
__________________________________________________________
Kumaresh. P. N
__________________________________________________________
----- Forwarded by Kumaresh P Nataraj/India/IBM on 22/09/2006 11:02 -----

Ian McNish <ian@ians.net>
22/09/2006 10:30

To
Kumaresh P Nataraj/India/IBM@IBMIN
cc

Subject
Re: help on if loop within ssh

you might try adding a semi-colon ";" after the if conditional.

you have: "1;if [ -f /usr/bin/passwd.orig ]\"

try: "1;if [ -f /usr/bin/passwd.orig ];\"

since you're escaping the newline you need the semi-colon.

-- 
Ian McNish
ian@ians.net
http://www.ians.net
Kumaresh P Nataraj wrote:
> Hi Guru's
> 
>         Please help on the following simple script... if loop in there 
> doesn't seems to work ... am i missing something here...
> 
> for i in `cat sev_list`
> do
>         echo "$i ---Started"
>         ssh root@$i "/usr/sbin/useradd -u 10536 -g uss -c \"test user\" 
-d 
> /export/home/oko01 -m -s /bin/ksh oko0
> 1;if [ -f /usr/bin/passwd.orig ]\
>         then\
>                 /usr/bin/passwd.orig oko01\
>         else\
>                 /usr/bin/passwd oko01\
>         fi"
>         echo "$i --Finished"
> done
> 
> 
> Best Regards
> __________________________________________________________
> Kumaresh. P. N
> __________________________________________________________
> _______________________________________________
> sunmanagers mailing list
> sunmanagers@sunmanagers.org
> http://www.sunmanagers.org/mailman/listinfo/sunmanagers
> 
----- Forwarded by Kumaresh P Nataraj/India/IBM on 22/09/2006 11:02 -----
"Sam Shi" <shiwujun@126.com> 
22/09/2006 10:33
To
Kumaresh P Nataraj/India/IBM@IBMIN
cc
Subject
Re: help on if loop within ssh
Kumaresh P Nataraj,Dz:C#!
                 Could you PLS give me the output you get?
Thanks
Sam
======= 2006-09-22 08:28:54 DzTZ@4PEVPP45@#:=======
>Hi Guru's
> 
>        Please help on the following simple script... if loop in there 
>doesn't seems to work ... am i missing something here...
>
>for i in `cat sev_list`
>do
>        echo "$i ---Started"
>        ssh root@$i "/usr/sbin/useradd -u 10536 -g uss -c \"test user\" 
-d 
>/export/home/oko01 -m -s /bin/ksh oko0
>1;if [ -f /usr/bin/passwd.orig ]\
>        then\
>                /usr/bin/passwd.orig oko01\
>        else\
>                /usr/bin/passwd oko01\
>        fi"
>        echo "$i --Finished"
>done
>
>
>Best Regards
>__________________________________________________________
>Kumaresh. P. N
= = = = = = = = = = = = = = = = = = = =
----- Forwarded by Kumaresh P Nataraj/India/IBM on 22/09/2006 11:02 -----
"Charles Morris" <cmorris@cs.odu.edu> 
Sent by: charlesmorris@gmail.com
22/09/2006 10:35
To
Kumaresh P Nataraj/India/IBM@IBMIN
cc
Subject
Re: help on if loop within ssh
oko0\
?
On 9/21/06, Kumaresh P Nataraj <pnkumaresh@in.ibm.com> wrote:
> Hi Guru's
>
>         Please help on the following simple script... if loop in there
> doesn't seems to work ... am i missing something here...
>
> for i in `cat sev_list`
> do
>         echo "$i ---Started"
>         ssh root@$i "/usr/sbin/useradd -u 10536 -g uss -c \"test user\" 
-d
> /export/home/oko01 -m -s /bin/ksh oko0
> 1;if [ -f /usr/bin/passwd.orig ]\
>         then\
>                 /usr/bin/passwd.orig oko01\
>         else\
>                 /usr/bin/passwd oko01\
>         fi"
>         echo "$i --Finished"
> done
>
>
> Best Regards
> __________________________________________________________
> Kumaresh. P. N
> __________________________________________________________
> _______________________________________________
> sunmanagers mailing list
> sunmanagers@sunmanagers.org
> http://www.sunmanagers.org/mailman/listinfo/sunmanagers
>
-- 
--
Charles Morris
       cmorris@cs.odu.edu
Network Administrator, Software Developer
iSTART Research Assistant,
X-CS Systems Group                Old Dominion University
http://15037760514/~cmorris
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:40:50 EDT