Browse Source

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.
pull/358/head
Marquis Wong 4 years ago
parent
commit
22618b1fcf
  1. 8
      libexec/jenv-init

8
libexec/jenv-init

@ -22,13 +22,13 @@ done @@ -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"

Loading…
Cancel
Save