From a9a9636d1e739e047c8089e0319eed5c0cfebc21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 24 Dec 2015 13:23:01 +0100 Subject: [PATCH] Tweak sanitizing shell name Handles situation when the output is `/bin/shell- args...`. First strip away the arguments, then the trailing dash. --- libexec/rbenv-init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rbenv-init b/libexec/rbenv-init index 9fcfc2f4..7ddae5e5 100755 --- a/libexec/rbenv-init +++ b/libexec/rbenv-init @@ -34,8 +34,8 @@ done shell="$1" if [ -z "$shell" ]; then shell="$(ps -p "$PPID" -o 'args=' 2>/dev/null || true)" - shell="${shell##-}" shell="${shell%% *}" + shell="${shell##-}" shell="${shell:-$SHELL}" shell="${shell##*/}" fi