Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Positional parameters and sourced files
- X-seq: zsh-workers 11609
- From: Bernd Eggink <eggink@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: Positional parameters and sourced files
- Date: Sun, 28 May 2000 11:10:22 +0200
- In-reply-to: <1000528003111.ZM22806@xxxxxxxxxxxxxxxxxxxxxxx>; from schaefer@xxxxxxxxxxxxxxxxxxxxxxx on Sun, May 28, 2000 at 12:31:10AM +0000
- Mail-followup-to: zsh-workers@xxxxxxxxxxxxxx
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
- References: <1000528003111.ZM22806@xxxxxxxxxxxxxxxxxxxxxxx>
On Sun, May 28, 2000 at 12:31:10AM +0000, Bart Schaefer wrote:
> Put these commands in /tmp/test.zsh:
>
> echo $# $*
> set a b c d e
>
> Now:
>
> zsh% source /tmp/test.zsh ; echo $#
> 0
> 5
> zsh% source /tmp/test.zsh arg ; echo $#
> 1 arg
> 0
>
>
> So "set ..." in a sourced script changes the global positional parameters
> when the script is called with no arguments, but if it was called with any
> arguments then it changes only the locals. This seems a bit odd.
>
> Bash, on the other hand, always changes the global positional parameters,
> and further it throws away the local ones when the global ones are set. I
> don't have ksh handy to try.
ksh behaves the same way as zsh. IMHO the bash behavior is the most
reasonable one.
Regards,
Bernd
--
Bernd Eggink
Regionales Rechenzentrum der Uni Hamburg
eggink@xxxxxxxxxxxxxx
http://www.rrz.uni-hamburg.de/eggink/BEggink.html
Messages sorted by:
Reverse Date,
Date,
Thread,
Author