yikes... nice to learn something new everyday :-)
> cat zzz.sh
#!/bin/bash
echo "#1=$1"
> rsh localhost /bin/bash -c '/home/yoh/zzz.sh -k'
#1=
> rsh localhost /bin/bash -c '"/home/yoh/zzz.sh -k"'
#1=-k
> /bin/bash -c /home/yoh/zzz.sh sldkjf
#1=
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
#!/bin/bash
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
corrected?
--
.-.
=------------------------------ /v\ ----------------------------=
Keep in touch // \\ (yoh@|www.)onerussian.com
Yaroslav Halchenko /( )\ ICQ#: 60653192
Linux User ^^-^^ [175555]
Attachment:
pgpcmq9gCMQiK.pgp
Description: PGP signature