HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
cancel
Showing results for 
Search instead for 
Did you mean: 

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
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

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