LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Find out which shell I am currently using (https://www.linuxquestions.org/questions/red-hat-31/find-out-which-shell-i-am-currently-using-331611/)

Tajci 06-08-2005 01:51 PM

Find out which shell I am currently using
 
Hi,

I am trying to find out which shell I am currently working with.
If I "echo $SHELL", I get "/bin/sh", no matter which shell I am actually working with (ksh, bash, sh, csh).

The other option is to look to the passwd file.
And what, if I am not the root user ?

In other words:
It must be possible to know which shell is my login shell, but how ?

------------------------------ o O o ------------------------------

What I also would like to do:

> bash
[someuser@somenode] $ echo somewhat

or
[someuser@somenode] $ some command
output:
Bash Shell


OR:
> ksh
$ echo somewhat

or
$ some command
output:
Korn Shell


Can anybody help me ?

Thanks in advance,

Tajci

towlie 06-08-2005 03:15 PM

Use the 'ps' command to list your running processes,
and one of them should be your shell.

And you should be able to read /etc/passwd even if
not root.

twantrd 06-09-2005 01:22 AM

Yes, ps will tell you as well but this is also another approach which will tell you your current shell.

ps -o comm -p $$ | tail -1

-twantrd

Tajci 06-17-2005 03:03 PM

Hi, folks,

in the meantime I found out another method to get the actual shell:
The environment variable $0 (zero) contains also the information.

I tried the
ps -o comm -p $$ | tail -
as well.
Works fine.

Thanks,

Tajci


All times are GMT -5. The time now is 12:05 AM.