From 22618b1fcf28eec7a912062b5e808697662614b9 Mon Sep 17 00:00:00 2001 From: Marquis Wong Date: Sun, 8 May 2022 22:07:58 -0500 Subject: [PATCH] Improve shell detection code using `ps` to detect the shell fails in some cases (For me, it is using a docker container to run an x86 OS image on an M1 Mac - the process is is /usr/bin/qemu-x86_64 /bin/bash) Using the $[SHELL]-VERSION environment variables is probably the most fool-proof way to detect the shell. --- libexec/jenv-init | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libexec/jenv-init b/libexec/jenv-init index f77ab78..4a34e0c 100755 --- a/libexec/jenv-init +++ b/libexec/jenv-init @@ -22,13 +22,13 @@ done shell="$1" if [ -z "$shell" ]; then - if [-n "$BASH_VERSIONH"]; then + if [ -n "$BASH_VERSION" ]; then shell="bash" - elif [ -n "$ZSH_VERSION"]; then + elif [ -n "$ZSH_VERSION" ]; then shell="zsh" - elif [ -n "FISH_VERSION"]; then + elif [ -n "$FISH_VERSION" ]; then shell="fish" - elif [ -n "KSH_VERSION"]; then + elif [ -n "$KSH_VERSION" ]; then shell="ksh" else shell="unknown"