1752567 Members
5161 Online
108788 Solutions
New Discussion юеВ

Re: current shell

 
pa8700
Regular Advisor

current shell

guys i am changing my curent working shells dynamically just like nesting.So is there any command to know which is the current shell.

I am no expecting any answer like $SHELL
6 REPLIES 6
Avinash20
Honored Contributor

Re: current shell

# echo $SHELL
gives you the actual shell. If you have opend another one e.g. ksh from there then you can type
# echo $$
and look for the named process id. It will give you the named shell information
"Light travels faster than sound. That's why some people appear bright until you hear them speak."
pa8700
Regular Advisor

Re: current shell

thanks pls use echo $0
Dennis Handly
Acclaimed Contributor

Re: current shell

SHELL is only set by login and not the shell. As you said, $0 should work.

Why do you care what the current shell is? All scripts should force a shell. And if you want to know the current shell, type a bogus command.

>Avinash: echo $$ and look for the named process id.

Something like:
UNIX95=EXTENDED_PS ps -p $$ -ocomm=
Suraj K Sankari
Honored Contributor

Re: current shell

Hi,
here is the command to check which shell you are using

[suraj@rspc521 root]# echo $SHELL
/bin/bash

Suraj
Jozef_Novak
Respected Contributor

Re: current shell

# ps -ef | grep $$
pa8700
Regular Advisor

Re: current shell

thanks