How can I tell which Unix shell I am using? [duplicate]

Try:

echo $0

This often works across a range of shells.


Mac

ps

  PID TTY           TIME CMD
  223 ttys000    0:00.33 -bash

OpenBSD

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.


The echo $SHELL command will give you your shell name relative to root.