diff --git a/bin/brew b/bin/brew index e31cbd0c0d..ac635ce4f4 100755 --- a/bin/brew +++ b/bin/brew @@ -1,5 +1,14 @@ #!/bin/bash -set +o posix + +# Fail fast with concise message when not using bash +# Single brackets is needed here for POSIX compatibility +if [ -z "${BASH_VERSION:-}" ] +then + echo "Error: Bash is required to run brew." >&2 + exit 1 +fi + +set +o posix # as we are using bash now # Fail fast with concise message when cwd does not exist if ! [[ -d "${PWD}" ]] @@ -8,13 +17,6 @@ then exit 1 fi -# Fail fast with concise message when not using bash -if [ -z "${BASH_VERSION:-}" ] -then - echo "Error: Bash is required to run brew." >&2 - exit 1 -fi - quiet_cd() { cd "$@" &>/dev/null || return }