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

Re: argzero while sourcing standard scripts



Peter Stephenson wrote:
> Zsh doesn't set argzero (i.e. $0) while sourcing standard scripts,
> although it does when sourcing anything else so long as
> FUNCTIONARGZERO is set (which it is by default for native emulation
> and I can't think of a good reason for turning it off for a `real'
> zsh).  This means the error messages from standard scripts are rather
> unhelpful in that you don't get the name of the script with the error.

It is certainly wrong that the filename isn't mentioned in the error
message but setting argzero it probably the wrong solution for that.  One
may want to invoke zsh under different names to get customized behaviour.
In the startup files $0 can be used to decide the prefered option settings
etc.  OK, the ZSH_NAME parameter can be used for that.  But when you
execute a script $0 is set to the script name which can be used in zshenv.
Setting $0 to zshenv would make it impossible to get the name of the script
we are executing.

Zoltan



Messages sorted by: Reverse Date, Date, Thread, Author