Determining current shell
Is there any straight forward way to determine the current shell?
$SHELL gives the login shell. A descending sort of ps -aef and grepping one of sh, bash, csh, ksh can also give it, but that is programming. Is there any command? Thx in advance. Regds, Subu |
How about which $SHELL
|
As I have mentioned in my original post, $SHELL gives the login shell.
e.g, if I login through bash and then do a 'csh' , the $SHELL is still 'bash' and not 'csh'. That is the problem. |
Code:
ps -o comm -p $$ | tail -1 |
I don't think there is a simple way
I've pondered this problem myself. you'll have to use the 'ps' route. It depends on which shell you are in at the time as to how it behaves. So you can't rely on consistent behaviour between different shells. |
I tested jlliagre's method and it works fine. Though it involves ps, it is a one line command and gives the desired o/p.
Thanks jlliagre |
Quote:
Code:
cat /proc/$$/cmdline |
echo $0 works for me.
|
Okay, I yield, that's seems unbeatable !
|
not so fast mr bond....
Code:
billy, |
Hi,
Don't know if this works on a linux box, but on AIX it does: echo $_ It even works for the csh shell :) [edit] Only works after the first 'switch'....... :( [/edit] |
AHA!
not so fast blofeldt! (on solaris!) Code:
primadtpliv% bash |
All times are GMT -5. The time now is 03:21 PM. |