[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: something strange with rsh/ssh + bash/tcsh is happening. Please advise

yikes... nice to learn something new everyday :-)

> cat zzz.sh 
echo "#1=$1"

> rsh localhost /bin/bash -c '/home/yoh/zzz.sh -k'

> rsh localhost /bin/bash -c '"/home/yoh/zzz.sh -k"'

> /bin/bash -c /home/yoh/zzz.sh sldkjf

heh heh

so it seems that not that $1==-k, it is just that 
bash disregards all positional parameters if they are not included in
the argument after -c. BUT in the man page it says:

       -c string If  the  -c  option  is  present, then commands are read from
                 string.  If there are arguments after the  string,  they  are
                 assigned to the positional parameters, starting with $0.

so - sldkjf (if I read English correctly) should be assigned to $0
(yikes again). Lets try:

> cat zzz.sh 
echo "#0=$0 #1=$1"

*> /bin/bash -c /home/yoh/zzz.sh  sldkjf sdf sdf
#0=/home/yoh/zzz.sh #1=

so what the hell is right in this situation???? shouldn't man page be

=------------------------------   /v\  ----------------------------=
Keep in touch                    // \\     (yoh@|www.)onerussian.com
Yaroslav Halchenko              /(   )\               ICQ#: 60653192
                   Linux User    ^^-^^    [175555]

Attachment: pgpSC8MU1G5jk.pgp
Description: PGP signature

Reply to: