From 32030e2ed952d3e395f2ca3ba692582b8ddd56fb Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 10 May 2015 16:03:06 +0200 Subject: [PATCH] Fix shell version when invoked from a script When invoked from a shell script, `$(rbenv init -)` did not get the shell name correct. It needs to look at the `args` value from `ps`. Ref: https://github.com/yyuu/pyenv/issues/373 --- libexec/rbenv-init | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libexec/rbenv-init b/libexec/rbenv-init index 8e6ee3d8..9fcfc2f4 100755 --- a/libexec/rbenv-init +++ b/libexec/rbenv-init @@ -33,7 +33,7 @@ done shell="$1" if [ -z "$shell" ]; then - shell="$(ps c -p "$PPID" -o 'ucomm=' 2>/dev/null || true)" + shell="$(ps -p "$PPID" -o 'args=' 2>/dev/null || true)" shell="${shell##-}" shell="${shell%% *}" shell="${shell:-$SHELL}"