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

Re: zsh not sourcing /etc/profile?



Richard Coleman wrote:
> I found this article on comp.unix.shells.  I thought I would
> pass it along.
[...]
> > posix-sh, ksh, and bash all return the name of the shell for $0 when
> > sourcing a file.
> >
> > Only zsh returns the name of the file being sourced.  I suspect the
> > right behaviour is to return the shell name.  The reason for this is
> > that sourcing a file does not create a new process, it should behave
> > as if the file had been typed from the keyboard.  If you type the
> > command "echo $0" at the prompt, it should return the shell name.
> > Although I really like zsh, I think it does not have the right
> > behaviour because you can't rely on $0 to determine which shell is
> > interpreting the file.

Under zsh this is controlled by the FUNCTION_ARGZERO option, which is set
when zsh is started as sh/ksh.

Zoltan



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