A login shell starts with a "-"

A login shell process is started with a "-" as the first character in
the process name. It is the case with Terminal on Mac OS X.

See http://docstore.mik.ua/orelly/unix/upt/ch51_09.htm
This commit is contained in:
Ludovic Rousseau 2012-08-13 16:28:07 +02:00
parent 0818aa1869
commit 86f8dba07f

View File

@ -39,6 +39,11 @@
WORKING_SHELL=$(ps -p $$ | tail -n1 | awk '{print $NF}')
# A login shell starts with a "-"
if [[ "$WORKING_SHELL" == "-bash" ]]; then
WORKING_SHELL="bash"
fi
if [[ "$WORKING_SHELL" == "bash" ]]; then
# Check for recent enough version of bash.
[[ -z "$BASH_VERSION" || -z "$PS1" || -z "$TERM" ]] && return;