From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14504 invoked from network); 14 Apr 1997 17:54:14 -0000 Received: from euclid.skiles.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 14 Apr 1997 17:54:14 -0000 Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id NAA07303; Mon, 14 Apr 1997 13:43:18 -0400 (EDT) Resent-Date: Mon, 14 Apr 1997 13:43:18 -0400 (EDT) Sender: coleman@math.gatech.edu To: zsh-workers@math.gatech.edu Subject: Re: zsh not sourcing /etc/profile? References: <5ifr3t$sub@charm.il.ft.hse.nl> <5irn2i$b2p@charm.il.ft.hse.nl> <5itdj0$dc0@bmtlh10.bnr.ca> From: Richard Coleman Date: 14 Apr 1997 13:42:44 -0400 In-Reply-To: alainc@bnr.ca's message of 14 Apr 1997 14:05:20 GMT Message-ID: X-Mailer: Gnus v5.3/Emacs 19.34 Resent-Message-ID: <"JsfwF2.0.2o1.socKp"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3073 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu I found this article on comp.unix.shells. I thought I would pass it along. rc > > I found out it does, yes. However, I did stumble upon some bash sillyness > > now. One of the admins we have put something similar to the following in > > /etc/profile: > > case "$0" in > > -bash|-zsh) > > do stuff > > ;; > > ... > > esac > > > Now, bash seems to expand the $0 to '-bash', whereas zsh expands it to > > (which I would think is the _correct_ expansion) '/etc/profile'. It's an > > old bash version we use here (1.14.7(1)), so I assume this is fixed > > already in newer versions. > > On my system, HP-UX 9.05 > > 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.