Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Positional parameters and sourced files
- X-seq: zsh-workers 11608
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Positional parameters and sourced files
- Date: Sun, 28 May 2000 00:31:10 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
Messages sorted by:
Reverse Date,
Date,
Thread,
Author