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

Re: sourcing of /etc/profile with $0 == -sh



"Andrej Borsenkow" wrote:
> In my /etc/zprofile I source /etc/profile. Unfortunately, it contains code
> depending of shell (that is, case $0 in -sh | -ksh ...). I don't want to
> mess up with system /etc/profile, so I tried to find a way to set $0 only
> for the time of sourcing. Currently I use (zsh-3.1.4):

I don't think you even need to make it local, since $0 is handled
similarly to the other positional arguments.

% fn() { 0=foo; echo $0; }  
% fn
foo
% echo $0
zsh

This fact should probably be construed as a genuine feature.  If you're
asking, is some bright spark going to decide that $0 should be different
from $1 to $infinity and break it, I can't answer that, but it won't be me.

-- 
Peter Stephenson <pws@xxxxxx>       Tel: +39 50 844536
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy



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