zsh-workers
 help / color / mirror / code / Atom feed
* Positional parameters and sourced files
@ 2000-05-28  0:31 Bart Schaefer
  2000-05-28  9:10 ` Bernd Eggink
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2000-05-28  0:31 UTC (permalink / raw)
  To: zsh-workers

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   


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2000-05-28 17:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-28  0:31 Positional parameters and sourced files Bart Schaefer
2000-05-28  9:10 ` Bernd Eggink
2000-05-28 17:16   ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).