File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -113,21 +113,23 @@ BIN_BREW_EXPORTED_VARS=(
113113# Load Homebrew's variable configuration files from disk.
114114export_homebrew_env_file () {
115115 local env_file
116+ local bin_brew_exported_vars_regex
116117
117118 env_file=" ${1} "
118119 [[ -r " ${env_file} " ]] || return 0
120+
121+ bin_brew_exported_vars_regex=" ^($(
122+ IFS=' |'
123+ echo " ${BIN_BREW_EXPORTED_VARS[*]} "
124+ ) )"
125+
119126 while read -r line
120127 do
121128 # only load variables defined in env_config.rb
122129 [[ " ${line} " =~ ^(HOMEBREW_| SUDO_ASKPASS=| (all| no| ftp| https? )_proxy=) ]] || continue
123130
124131 # forbid overriding variables that are set in this file
125- local invalid_variable
126- for VAR in " ${BIN_BREW_EXPORTED_VARS[@]} "
127- do
128- [[ " ${line} " = " ${VAR} " * ]] && invalid_variable=" ${VAR} "
129- done
130- [[ -n " ${invalid_variable:- } " ]] && continue
132+ [[ " ${line} " =~ ${bin_brew_exported_vars_regex} ]] && continue
131133
132134 export " ${line?} "
133135 done < " ${env_file} "
You can’t perform that action at this time.
0 commit comments