From: Sumair Mahmood (Sumair.Mahmood@qlogic.com)
Date: Tue Jun 04 2002 - 19:02:23 EDT
QUESTION:
=========
Why does `echo $SHELL` "lie" when you change shells?
> My default shell is 'csh'
mysystem{root} 2 : echo $SHELL
/bin/csh
> No problems here
> If I use 'bash', $SHELL still indicates 'csh'
mysystem{root} 3 : bash
bash-2.03# echo $SHELL
/bin/csh
> If I use 'tcsh', $SHELL also indicates 'csh'
bash-2.03# exit
exit
mysystem{root} 4 : tcsh
mysystem{root} 1 : echo $SHELL
/bin/csh
ANSWER:
========
This is a perfectly normal behavior. The value of $SHELL
is not set by the shell; it's passed through as part of your
environment from the process that creates your login and
launches your shell (for instance, 'login', 'telnetd' or 'sshd'):
# man login
...
The basic environment is initialized to:
HOME=your-login-directory
LOGNAME=your-login-name
PATH=/usr/bin:
SHELL=last-field-of-passwd-entry
MAIL=/var/mail/TZ=timezone-specification
...
Since your login shell is 'csh', $SHELL is set to /bin/csh
when you first login, and remains untouched no matter
what other shell is invoked afterward. Therefore $SHELL
is your login shell NOT your current shell.
To find your current shell in Solaris, try:
# echo $0
or
# /bin/ps -p $$
# /bin/ps -p $$ -o comm=
etc.
[ With sincere thanks to Sanjiv Bhatia, Wesley Wannemacher,
Fabrice Guerini, Amir Mahajan, Michael Maciolek, Kevin
Inscoe, and everyone else who responded!]
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:24:25 EDT