1834146 Members
3659 Online
110064 Solutions
New Discussion

Re: about shell

 
SOLVED
Go to solution
leyearn
Regular Advisor

about shell

as we know
the default shell in hpux is posix shell
under the default shell
i enter the ksh
#ksh
but how can i know which shell i am under whenever?
6 REPLIES 6
Hein van den Heuvel
Honored Contributor

Re: about shell

Is it? I naively thought it was whatever you set up in /etc/passwd


Anyway... how about: echo $SHELL

or: env | grep SHELL

Hein.
Steven E. Protter
Exalted Contributor

Re: about shell

echo $SHELL

The default is set by admin in /etc/passwd

Posix and Korn shell are identical in many features.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
T G Manikandan
Honored Contributor

Re: about shell


you can also do a

#ps

and check for the largest pid used by a shell.That is the shell you are working.

ex.
24917 pts/te 0:00 ps
22839 pts/te 0:00 telnetd
22840 pts/te 0:00 sh
24916 pts/te 0:00 ksh


here i am now working on ksh.24916 is the latest process than 22840
Mark Grant
Honored Contributor

Re: about shell

Actually, the portable way to do it, regardless of what shell you happen to be in at the time is.

echo $0
Never preceed any demonstration with anything more predictive than "watch this"
Elmar P. Kolkman
Honored Contributor

Re: about shell

Or: ps -p $$
If your only interested in the shell itself: ps -p $$ | awk '{print $NF}'
$$ contains the process number of your current shell.

$SHELL is set when logging in, but if you start a subshell it will not get updated. $$ will.
Every problem has at least one solution. Only some solutions are harder to find.
Elmar P. Kolkman
Honored Contributor
Solution

Re: about shell

'echo $0' does not work with the csh... Bear that in mind.
Every problem has at least one solution. Only some solutions are harder to find.