Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Passing parameters between noninteractive shells
- X-seq: zsh-users 10900
- From: Phil Pennock <phil.pennock@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Passing parameters between noninteractive shells
- Date: Wed, 25 Oct 2006 12:45:52 +0200
- In-reply-to: <20061025083114.GA29910@xxxxxxxxxx>
- Mail-followup-to: zsh-users@xxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20061025083114.GA29910@xxxxxxxxxx>
- Sender: Phil Pennock <phil@xxxxxxxxxxxxx>
On 2006-10-25 at 10:31 +0200, Wojciech Pietron wrote:
> ===============.zshrc================
> if [[ $ZSH_VERSION == 3.<->* ]]; then
> if [[ -x $HOME/bin/zsh && -o interactive ]]; then
> exec $HOME/bin/zsh
exec $HOME/bin/zsh "$@"
> else
> if [[ -x $HOME/bin/zsh && ! -o interactive ]]; then
> exec $HOME/bin/zsh +o interactive
I'd think that this whole branch of the logic becomes unnecessary with
"$@", but if it is still needed then just put "$@" afterwards.
> The problem is with non-interactive sessions such as remote scp or cvs. This
> configuration makes such sessions hang because a new zsh is run and it does not
> know what it should do until I send 'exit' command. This is because the
> new shell is not given any parameters that had been passed to the
> previous instance of the shell - I believe so.
A shell script's parameters are available in $@ / $* and in zsh in
$argv.
With parameters:
alpha
foo bar
wibble
then:
"$*" == 'alpha foo bar wibble'
"$@" == 'alpha' 'foo bar' 'wibble'
(ie, _most_ times that you see $* in a script it's a bug, normally "$@"
is what's needed)
See zshparam(1), "POSITIONAL PARAMETERS" section.
Regards,
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author