Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: SHELL not always correct
- X-seq: zsh-users 13370
- From: Stephane Chazelas <Stephane_Chazelas@xxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, dqarras@xxxxxxxxx, ZSH Users <zsh-users@xxxxxxxxxx>, pws@xxxxxxxxxxxxxxxxxxx
- Subject: Re: SHELL not always correct
- Date: Wed, 22 Oct 2008 12:40:19 +0100
- In-reply-to: <20081021231323.GA89901@xxxxxxxxxxxxxxxxxxxx>
- Mail-followup-to: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>, dqarras@xxxxxxxxx, ZSH Users <zsh-users@xxxxxxxxxx>, pws@xxxxxxxxxxxxxxxxxxx
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <903527.44182.qm@xxxxxxxxxxxxxxxxxxxxxxxxxxx> <200810212058.m9LKwXQe009278@xxxxxxxxxxxxxxxxxxx> <20081021231323.GA89901@xxxxxxxxxxxxxxxxxxxx>
On Tue, Oct 21, 2008 at 04:13:23PM -0700, Phil Pennock wrote:
[...]
> work/bash-3.2/variables.c: temp_var = find_variable ("SHELL");
> work/bash-3.2/variables.c: temp_var = bind_variable ("SHELL", current_user.shell, 0);
> work/bash-3.2/shell.c: set_var_read_only ("SHELL");
>
> Okay, I peeked at variables.c and this comment:
> /* Set $SHELL to the user's login shell if it is not already set. Call
> get_current_user_info if we haven't already fetched the shell. */
> decorates set_shell_var() which forcibly claims SHELL for itself.
>
> Seems rather presumptuous, to claim to child processes that you are the
> user's chosen preferred shell, merely because you're running.
[...]
No, bash doesn't set $SHELL to bash, that would be a bug if it
did, it just sets $SHELL to the user's login shell if it's not
already set which is fine. Here, my login shell is zsh,
$ env -i bash -c 'echo $SHELL'
/bin/zsh
$ env SHELL=/bin/rc bash -c 'echo $SHELL'
/bin/rc
So bash acknowledges my choice, it just sets $SHELL in case it
wasn't set before.
Basically, it's doing the job of login(1). login(1) is the
command that generally initialises $SHELL (that is the user's
shell of choice) to the user's login shell (from the "passwd"
database).
--
Stéphane
Messages sorted by:
Reverse Date,
Date,
Thread,
Author