strip initial - from the name of shell process

Avoids the case where shell detection would result in
`basename "-bash"` invocation, triggering the error:

    basename: illegal option -- b

fixes #462
This commit is contained in:
Mislav Marohnić 2013-10-07 14:18:36 +02:00
parent 878bd87328
commit 3300587c6b

View file

@ -23,6 +23,7 @@ done
shell="$1"
if [ -z "$shell" ]; then
shell="$(ps c -p $(ps -p $$ -o 'ppid=' 2>/dev/null) -o 'comm=' 2>/dev/null || true)"
shell="${shell##-}"
shell="$(basename "${shell:-$SHELL}")"
fi