On some the shell can be read on in the command prompt, other can be seen when help
is ran. But this are not covered by all the shells.
Is there a general command to see what shell is running?
On some the shell can be read on in the command prompt, other can be seen when help
is ran. But this are not covered by all the shells.
Is there a general command to see what shell is running?
This should work with most shells and most OSes:
$ ps -o comm -p $$ | tail -n -1
ksh93
Edit: after reading the duplicate link, here is a simpler way that avoids the tail command.
$ ps -o comm= -p $$
ksh93
-n -1
and -n 1
are equivalent, while -n +1
is not. Bizarre.
– l0b0
May 15 '13 at 13:40
tail -1
for the last line and tail +1
for the first one. They kept the same syntax when -n
was added not to break habits/usage. Not specifying a sign shouldn't but mean the last line(s), as the -
in tail -1
was more to introduce an option than a sign indicator.
– jlliagre
May 15 '13 at 13:57
You can see in /etc/passwd file, or type:
echo $SHELL
or
env
to see your default shell.