aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/brew9
1 files changed, 6 insertions, 3 deletions
diff --git a/bin/brew b/bin/brew
index 0fabbb97e..f73ba14e1 100755
--- a/bin/brew
+++ b/bin/brew
@@ -7,10 +7,13 @@ quiet_cd() {
BREW_FILE_DIRECTORY="$(quiet_cd "${0%/*}/" && pwd -P)"
HOMEBREW_BREW_FILE="${BREW_FILE_DIRECTORY%/}/${0##*/}"
-
HOMEBREW_PREFIX="${HOMEBREW_BREW_FILE%/*/*}"
-[[ -n "$HOMEBREW_PREFIX" && "$HOMEBREW_PREFIX" != "$HOMEBREW_BREW_FILE" ]] \
- || HOMEBREW_PREFIX="/"
+
+# Default to / prefix if unset or the bin/brew file.
+if [[ -z "$HOMEBREW_PREFIX" || "$HOMEBREW_PREFIX" = "$HOMEBREW_BREW_FILE" ]]
+then
+ HOMEBREW_PREFIX="/"
+fi
HOMEBREW_REPOSITORY="$HOMEBREW_PREFIX"