Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 91725 - Executing `tcsh' doesn't change the value of $SHELL; should it?
Summary: Executing `tcsh' doesn't change the value of $SHELL; should it?
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Unspecified (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Daniel Black (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-06 12:27 UTC by Prof. Jonathan King
Modified: 2006-11-27 09:57 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Prof. Jonathan King 2005-05-06 12:27:51 UTC
Running the bash shell:

    % echo $SHELL
    /bin/bash

    % tcsh

    % echo $SHELL
    /bin/bash

Is SHELL intended to show the original-invocation shell, or the
current shell?

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Daniel Black (RETIRED) gentoo-dev 2005-05-20 17:44:32 UTC
defered to experts in bug  35434 
Comment 2 Fabian Groffen gentoo-dev 2005-09-13 09:07:25 UTC
works fine for me...

% echo $SHELL
/bin/tcsh
% echo $shell
/bin/tcsh
Comment 3 Fabian Groffen gentoo-dev 2005-09-13 10:36:52 UTC
ok, if you fork a tcsh shell from a bash shell, indeed the $SHELL variable is
not (re)set.  the $shell variable (internal to tcsh) however, is set:

pegatoo linux # tcsh
(pegatoo:/usr/src/linux) # echo $SHELL
/bin/bash
(pegatoo:/usr/src/linux) # echo $shell
//bin/tcsh

otherwise it works like expected.  I think this not a Gentoo specific bug, but
more normal behaviour.  It works the same the other way around (on a non-Gentoo
system):

(pegasus:current/xquery/runtime) % echo $SHELL
/bin/tcsh
(pegasus:current/xquery/runtime) % bash
bash-3.00$ echo $SHELL
/bin/tcsh

Judging from this behaviour, I think it shouldn't and this bug can be closed.
Comment 4 Fabian Groffen gentoo-dev 2005-09-27 12:26:38 UTC
This is normal behaviour.  Only login shells set the SHELL variable.
Comment 5 Matus UHLAR - fantomas 2006-11-27 08:54:12 UTC
I think not the login _shell_, bug the _login_ process should set SHELL variable.
the SHELL should contain users' login shell, not anything like "last (login) shell executed". I think this bug is bogus, and that the "setenv SHELL" should disappear from /etc/csh.login.

Is user wishes so, he may set SHELL in his ~/.* rc files
Comment 6 Fabian Groffen gentoo-dev 2006-11-27 09:07:37 UTC
(In reply to comment #5)
> ... I think this bug is bogus, and that the "setenv SHELL" should
> disappear from /etc/csh.login.

I believe it is there for compatibility with scripts that rely on $SHELL being defined, while tcsh internally uses $shell for that.
Comment 7 Matus UHLAR - fantomas 2006-11-27 09:15:57 UTC
$shell in (t)csh is a local variable, used internally. It has to be set to (t)csh location. $SHELL is environment variable set by login and contains a variable a any program should execute when user wishes to jump to shell (many programs still support shell escape). So, they two have different meanings. Imho none of them should be set by rc script, unless user wishes so (and to his own responsibility).

Just my SKK.02 ;)
Comment 8 Fabian Groffen gentoo-dev 2006-11-27 09:57:05 UTC
I'll dig into a few other distros to see what they do, and yank the SHELL = bla thing if none do that.  How about that?