Is there an easy way by which I can tell which type of unix shell I am in i.e. whether I am in a bash / csh / ksh / tcsh
?
views:
59answers:
4
A:
basename $SHELL
don't know if it works for other shells than bash.
edit this has been asked a few days ago: how-to-determine-the-current-shell-im-working-on
mvds
2010-07-28 02:01:04
at times, not reliable.
ghostdog74
2010-07-28 02:05:46
+3
A:
mac:~$ ps
PID TTY TIME CMD
223 ttys000 0:00.33 -bash
obsd:~$ ps
PID TT STAT TIME COMMAND
20038 p0 Ss 0:00.01 -ksh (ksh)
22251 p0 R+ 0:00.00 ps
Or just echo $SHELL
Nikolai N Fetissov
2010-07-28 02:01:13
I think `$SHELL` is the default shell for the system (or user), which is usually (but not necessarily) the shell that is actually being used at any given moment.
David Zaslavsky
2010-07-28 02:22:43
A:
Every shell I know of sets the $ variable ($$) to its pid. So...
ps | grep $$
pra
2010-08-03 18:14:09