Permalink
Browse files

Improve shell detection.

* This code change copied over from rbenv-init
  • Loading branch information...
1 parent 92dbdf6 commit 401ee652aacb115fa6acb643020d1462ba9e2414 @finn finn committed Dec 24, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 libexec/plenv-init
View
@@ -22,12 +22,14 @@ done
shell="$1"
if [ -z "$shell" ]; then
- shell="$(basename "$SHELL")"
+ shell="$(ps c -p $(ps -p $$ -o 'ppid=' 2>/dev/null) -o 'comm=' 2>/dev/null || true)"
+ shell="${shell##-}"
+ shell="$(basename "${shell:-$SHELL}")"
fi
READLINK=$(type -p greadlink readlink | head -1)
if [ -z "$READLINK" ]; then
- echo "rbenv: cannot find readlink - are you missing GNU coreutils?" >&2
+ echo "plenv: cannot find readlink - are you missing GNU coreutils?" >&2
exit 1
fi

0 comments on commit 401ee65

Please sign in to comment.