Skip to content

Commit

Permalink
Revert "Assume unknown shells are bash-compatible"
Browse files Browse the repository at this point in the history
This reverts commit 22618b1.
This reverts commit 45efe53.
This reverts commit 00e2131.
This reverts commit a4dc56f.
  • Loading branch information
Marquis Wong authored and Marquis Wong committed May 26, 2022
1 parent 399b5af commit 23c910e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion libexec/jenv-hooks
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ shopt -s nullglob
for path in ${JENV_HOOK_PATH//:/$'\n'}; do

case "$shell" in
bash | * )
bash )
for script in $path/"$JENV_COMMAND"/*.bash; do
echo $(realpath $script)
done
Expand Down
22 changes: 14 additions & 8 deletions libexec/jenv-init
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ 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##*/}"
if [-n "$BASH_VERSIONH"]; then
shell="bash"
elif [ -n "$ZSH_VERSION"]; then
shell="zsh"
elif [ -n "FISH_VERSION"]; then
shell="fish"
elif [ -n "KSH_VERSION"]; then
shell="ksh"
else
shell="unknown"
fi
fi

resolve_link() {
Expand Down Expand Up @@ -95,7 +101,7 @@ fish )
echo "set -e JAVA_HOME"
echo "set -e JDK_HOME"
;;
bash | zsh | * )
bash | zsh )
echo 'export PATH="'${JENV_ROOT}'/shims:${PATH}"'
echo "export JENV_SHELL=$shell"
echo "export JENV_LOADED=1"
Expand Down Expand Up @@ -137,11 +143,11 @@ function jenv
end
EOS
;;
bash | zsh | * )
bash | zsh )
IFS="|"
cat <<EOS
jenv() {
type typeset &> /dev/null && typeset command
typeset command
command="\$1"
if [ "\$#" -gt 0 ]; then
shift
Expand Down

0 comments on commit 23c910e

Please sign in to comment.