Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Passing parameters between noninteractive shells
- X-seq: zsh-users 10906
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: Passing parameters between noninteractive shells
- Date: Wed, 25 Oct 2006 07:58:43 -0700
- In-reply-to: <20061025104552.GA29921@xxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20061025083114.GA29910@xxxxxxxxxx>	<20061025104552.GA29921@xxxxxxxxxxxxxxxxxxxxx>
On Oct 25, 12:45pm, Phil Pennock wrote:
}
} exec $HOME/bin/zsh "$@"
I always use
    export SHELL=$HOME/bin/zsh
    exec $SHELL -$- "$@"
Options passed to the shell are not present in "$@", you have to get them
from "$-".  That does potentially miss a few, as there are not values in
$- for all possible setopts, but it preserves things like "-l" for a
login shell.
} With parameters:
}  alpha
}  foo bar
}  wibble
} 
} then:
}  "$*" == 'alpha foo bar wibble'
}  "$@" == 'alpha' 'foo bar' 'wibble'
And, only in zsh and only with shwordsplit not set,
    $*  == "$@"
} (ie, _most_ times that you see $* in a script it's a bug, normally "$@"
}  is what's needed)
That statement is true for scripts that are meant to be portable among
various implementations of POSIX/Bourne-like shells.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author