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

Re: "exec zsh" inside .zprofile doesn't set SHELL



On Sep 21,  3:06pm, Clint Olsen wrote:
> Subject: "exec zsh" inside .zprofile doesn't set SHELL
> Hello:
> 
> ZSH_VERSION gets set properly to 3.1.6 in my login shell, but SHELL is set
> to /usr/intel/97r1.3/bin/zsh, which is the production version.  As a
> result, subshells spawned after that are incorrectly set to the old
> version.

You mean subshells spawned by other, intermediate processes, such as xterm
or make.

> I don't want to force the setting of SHELL (I had a similar
> problem with tcsh a long while back), I think the job of a shell is to set
> its own variable.
> 
> Bug?

No, it's not the job of the shell to attempt to point $SHELL at itself.  For
one thing, it's potentially impossible for a process to find out the path by
which it was executed -- it gets only what its parent put into argv[0], after
all.  Even if it could tell, consider the case of writing a shell script to
act as a wrapper around some other command: if the shell reset $SHELL when it
began executing the script, the environment would be "mysteriously" changed
for any further subprocesses of the enwrapped command.

In the situation you've described, you really do want something like

export SHELL==zsh && exec $SHELL


-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



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