Re: something strange with rsh/ssh + bash/tcsh is happening. Please advise
- To: email@example.com
- Subject: Re: something strange with rsh/ssh + bash/tcsh is happening. Please advise
- From: Henning Makholm <firstname.lastname@example.org>
- Date: Tue, 03 Jan 2006 18:07:37 +0100
- Message-id: <[🔎] email@example.com>
- References: <E1ErfOIfirstname.lastname@example.org> <20051228180308.GC2805@washoe.onerussian.com> <20051228185936.GA30060@love.zweije.nl.eu.org> <20051228191343.GD2805@washoe.onerussian.com> <20051228195839.GF2805@washoe.onerussian.com>
Scripsit Yaroslav Halchenko <email@example.com>
> -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????
Bash behaves as the manual page says. The string is
'/home/yoh/zzz.sh', and every $1 in that string did indeed get
expanded to sdf, after which the command reads '/home/yoh/zzz.sh'.
On the other hand:
$ bash -c 'echo 0=$0 1=$1' sldkjf sdf sdf
$ bash -c 'source zzz.sh' sldkjf sdf sdf
The argument to the -c option is being interpreted as _a shell script_
Henning Makholm "It will be useful even at this
early stage to review briefly the main
features of the universe as they are known today."