Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

(Fwd) Re: Value of $0



Another way zsh doesn't quite emulate ksh, just FYI.

--- Forwarded mail from David Korn <dgk@xxxxxxxxxxxxxxxx>

Date: Sun, 5 Aug 2001 23:06:41 -0400 (EDT)
From: David Korn <dgk@xxxxxxxxxxxxxxxx>
To: shell@xxxxxxxxxxxxxxxx
Subject: Re: Value of $0


POSIX treats functions as macros so it does not redefine $0. 
The conform, $0 must remain the name of the shell or script, not
the function name.  I had to change ksh93 to conform since ksh88
hade $0 be the function name.

This is one of the reasons that ksh has stuck with the function name()
syntax.  These functions have scoping and behave more like shell
scripts than macros.  $0 is defined as the name of the function
for function name() functions.

Also, set -x causes each line of a function to be traced with the POSIX
shell.  Using function name() in ksh93 does not do this and you
can set the trace attribute individually for each function using
	typeset -ft name

David Korn
research!dgk
dgk@xxxxxxxxxxxxxxxx
____________________________________________________________
To unsubscribe from this list, please send the following
two-line message to majordomo@xxxxxxxxxxxxxxxx, in which
your_email_address should be replaced by the address you
used when you subscribed to the list:
unsubscribe shell your_email_address
end


---End of forwarded mail from David Korn <dgk@xxxxxxxxxxxxxxxx>

-- 
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