Tweak sanitizing shell name

Handles situation when the output is `/bin/shell- args...`. First strip
away the arguments, then the trailing dash.
This commit is contained in:
Mislav Marohnić 2015-12-24 13:23:01 +01:00
parent 32030e2ed9
commit a9a9636d1e

View file

@ -34,8 +34,8 @@ done
shell="$1" shell="$1"
if [ -z "$shell" ]; then if [ -z "$shell" ]; then
shell="$(ps -p "$PPID" -o 'args=' 2>/dev/null || true)" shell="$(ps -p "$PPID" -o 'args=' 2>/dev/null || true)"
shell="${shell##-}"
shell="${shell%% *}" shell="${shell%% *}"
shell="${shell##-}"
shell="${shell:-$SHELL}" shell="${shell:-$SHELL}"
shell="${shell##*/}" shell="${shell##*/}"
fi fi