Shell
sys_shell¶
Print the name of the currently running shell. Tries /proc/$$cmdline, then various 'ps' invocations, then procstat (FreeBSD), then falls back to inspecting version variables. $SHELL is intentionally not used as it reflects the login shell, not the running shell. Does not work for fish shell, which requires non-Bourne-compatible introspection.
Exit codes¶
- 0: Success
- 1: Unable to determine the running shell
Output on stdout¶
- Shell name, e.g. "bash", "ksh", "zsh"