From 8f175cb03c57ac3a426d7cc1420f2b65aeaafd22 Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Fri, 20 Nov 2015 20:52:29 +0100 Subject: [PATCH] bin/brew: separate variable assignment and export This very slightly reduces duplication and the risk of inconsistency by exporting in one branch, but not the other. By putting all the `export` statements right before the `exec` it is more obvious what is passed on. --- bin/brew | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bin/brew b/bin/brew index 382c78f64e..c3468aaacc 100755 --- a/bin/brew +++ b/bin/brew @@ -4,7 +4,7 @@ chdir() { } BREW_FILE_DIRECTORY="$(chdir "${0%/*}" && pwd -P)" -export HOMEBREW_BREW_FILE="$BREW_FILE_DIRECTORY/${0##*/}" +HOMEBREW_BREW_FILE="$BREW_FILE_DIRECTORY/${0##*/}" BREW_SYMLINK="$(readlink "$0")" if [ -n "$BREW_SYMLINK" ] @@ -31,10 +31,13 @@ then BREW_SYSTEM="$(uname -s | tr "[:upper:]" "[:lower:]")" if [ "$BREW_SYSTEM" = "darwin" ] then - export HOMEBREW_RUBY_PATH="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby" + HOMEBREW_RUBY_PATH="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby" else - export HOMEBREW_RUBY_PATH="$(which ruby)" + HOMEBREW_RUBY_PATH="$(which ruby)" fi fi +export HOMEBREW_BREW_FILE +export HOMEBREW_RUBY_PATH + exec "$HOMEBREW_RUBY_PATH" -W0 "$BREW_LIBRARY_DIRECTORY/brew.rb" "$@"