brew: fail fast when not using bash
This commit is contained in:
parent
03017a84b4
commit
1be5e97e82
18
bin/brew
18
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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user