aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorXu Cheng2016-01-18 11:31:51 +0800
committerXu Cheng2016-01-20 13:55:06 +0800
commit6b5b8757bff12a3ad7089534a33935229964cff1 (patch)
tree005e0f5712c1c72146a38817adbb76deed12e9e2 /bin
parent92a71a534f9aa956eecc7ebeac0bd5dbe0ca980f (diff)
downloadbrew-6b5b8757bff12a3ad7089534a33935229964cff1.tar.bz2
bin/brew: fix incorrect argument manipulation
Shifting `-v` argument is all we need to do. We shouldn't enumerate arguments.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/brew21
1 files changed, 9 insertions, 12 deletions
diff --git a/bin/brew b/bin/brew
index 7eeb35db7..046e8ee29 100755
--- a/bin/brew
+++ b/bin/brew
@@ -118,18 +118,15 @@ then
exit 1
fi
-for i in "$@"
-do
- if [[ "$1" = -v ]]
- then
- shift
- set -- "$@" -v
- fi
- [[ "$i" =~ ^- ]] && continue
- HOMEBREW_COMMAND="$i"
- HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$i.sh"
- break
-done
+if [[ "$1" = -v ]]
+then
+ # Shift the -v to the end of the parameter list
+ shift
+ set -- "$@" -v
+fi
+
+HOMEBREW_COMMAND="$1"
+HOMEBREW_BASH_COMMAND="$HOMEBREW_LIBRARY/Homebrew/cmd/$1.sh"
if [ "$(id -u)" = "0" ] && [ "$(stat -f%u "$HOMEBREW_BREW_FILE")" != "0" ]
then