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

Re: environment settings



On Mon, Jun 23, 2008 at 09:20:11AM -0700, Bart Schaefer wrote:
> On Jun 23,  4:24pm, Stephane Chazelas wrote:
> }
> } It's true it would be nice to be able to distinguish between zsh
> } instances that are meant to be user shells that is that are
> } meant to parse command lines given by the user and instances
> } that are meant to run canonical zsh code where the user is not
> } meant to alter the zsh behavior (as in zsh scripts, zsh -c ...) 
> } 
> } With zsh, you could solve that by having $SHELL be /path/to/user-zsh
> 
> Unfortunately I think you at least have to turn this inside-out, because
> /etc/passwd usually is restricted to values that are in /etc/shells.
> 
> So something like this in .zshenv:
> 
> if [[ $0 != (*/|)user-zsh && -o interactive ]]; then
>   export SHELL=~/bin/user-zsh
>   # ... etc. ...
> fi
> 
> But that's not going to address Vincent's complaint that shells started
> for globbing by e.g. GDB should pick up settings like extended_glob.
> Even SHLVL isn't always accurate; what you'd really need to do is look
> up the parent process and decide based on that.

Then you can set $SHELL to user-zsh in .zprofile and use the
same trick as I was suggesting (that is source .zshrc in .zshenv
if $0 is user-zsh). Won't work for ssh though.

That's the kind of trick you use when you want to use zsh on
systems where zsh is not installed system-wide or where you're
not allowed to change your login shell (
# ~/.profile simplified
SHELL=~/bin/user-zsh
export SHELL
exec "$SHELL"
)


-- 
Stéphane



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