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