Re: something strange with rsh/ssh + bash/tcsh is happening. Please advise
- To: debian-devel@lists.debian.org
- Subject: Re: something strange with rsh/ssh + bash/tcsh is happening. Please advise
- From: Henning Makholm <henning@makholm.net>
- Date: Tue, 03 Jan 2006 18:07:37 +0100
- Message-id: <[🔎] 878xtxb5pi.fsf@kreon.lan.henning.makholm.net>
- References: <E1ErfOI-000355-00@ravana.ravana.rutgers.edu> <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 <debian@onerussian.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
> #!/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????
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
0=sldkjf 1=sdf
$ bash -c 'source zzz.sh' sldkjf sdf sdf
#0=sldkjf #1=sdf
$
The argument to the -c option is being interpreted as _a shell script_
itself.
--
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."
Reply to: