Skip to content

Commit

Permalink
Support set -eu
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderYastrebov committed Jan 11, 2024
1 parent 6529e01 commit 0bf8782
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/bash/sdkman-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ esac
zsh_shell=false
bash_shell=false

if [[ -n "$ZSH_VERSION" ]]; then
if [[ -n "${ZSH_VERSION:-}" ]]; then
zsh_shell=true
elif [[ -n "$BASH_VERSION" ]]; then
elif [[ -n "${BASH_VERSION:-}" ]]; then
bash_shell=true
fi

Expand Down Expand Up @@ -166,7 +166,7 @@ if [[ "$sdkman_auto_env" == "true" ]]; then

export SDKMAN_OLD_PWD="$PWD"
}

trimmed_prompt_command="${PROMPT_COMMAND%"${PROMPT_COMMAND##*[![:space:]]}"}"
[[ -z "$trimmed_prompt_command" ]] && PROMPT_COMMAND="sdkman_auto_env" || PROMPT_COMMAND="${trimmed_prompt_command%\;};sdkman_auto_env"
fi
Expand Down

0 comments on commit 0bf8782

Please sign in to comment.