From 3f96d963f7a2e5ff0f084bcb16e7f95e5aa72cfd Mon Sep 17 00:00:00 2001 From: XuehaiPan Date: Mon, 13 Sep 2021 20:32:20 +0800 Subject: [PATCH] style: fix inconsistent code style for shell scripts --- .github/workflows/docker.yml | 20 +-- .github/workflows/sorbet.yml | 17 +- .github/workflows/spdx.yml | 17 +- .github/workflows/tests.yml | 21 +-- .github/workflows/update-man-completions.yml | 26 ++-- .github/workflows/vendor-gems.yml | 9 +- .vscode/settings.json | 2 +- Dockerfile | 2 +- Library/Homebrew/brew.sh | 146 +++++++++++------- Library/Homebrew/cask/utils/rmdir.sh | 21 ++- Library/Homebrew/cmd/--version.sh | 11 +- Library/Homebrew/cmd/shellenv.sh | 6 +- Library/Homebrew/cmd/update-reset.sh | 6 +- Library/Homebrew/cmd/update.sh | 115 +++++++------- Library/Homebrew/cmd/vendor-install.sh | 52 ++++--- Library/Homebrew/dev-cmd/rubocop.sh | 3 +- Library/Homebrew/items.sh | 25 +-- Library/Homebrew/prefix.sh | 31 ++-- Library/Homebrew/shims/linux/super/make | 20 ++- Library/Homebrew/shims/mac/super/pkg-config | 3 +- Library/Homebrew/shims/mac/super/ruby | 5 +- Library/Homebrew/shims/mac/super/swift | 5 +- Library/Homebrew/shims/mac/super/xcrun | 46 +++--- Library/Homebrew/shims/scm/git | 4 +- Library/Homebrew/shims/super/cc | 4 +- Library/Homebrew/shims/utils.sh | 33 ++-- Library/Homebrew/utils/analytics.sh | 4 +- Library/Homebrew/utils/lock.sh | 2 +- Library/Homebrew/utils/ruby.sh | 17 +- bin/brew | 2 +- docs/Common-Issues.md | 6 +- docs/FAQ.md | 4 +- docs/Formula-Cookbook.md | 2 +- docs/Gems,-Eggs-and-Perl-Modules.md | 2 +- docs/Homebrew-and-Python.md | 2 +- ...omebrew-linuxbrew-core-Maintainer-Guide.md | 11 +- docs/Homebrew-on-Linux.md | 10 +- docs/How-To-Open-a-Homebrew-Pull-Request.md | 4 +- ...rew-with-Homebrew-keg-only-Dependencies.md | 8 +- docs/Manpage.md | 2 +- docs/Shell-Completion.md | 18 ++- docs/Tips-N'-Tricks.md | 4 +- manpages/brew.1 | 4 +- 43 files changed, 421 insertions(+), 331 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b74e53d2df..a1c2b3252c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -34,11 +34,11 @@ jobs: - name: Deploy the tagged Docker image to GitHub Packages if: startsWith(github.ref, 'refs/tags/') run: | - brew_version=${GITHUB_REF:10} - echo "brew_version=$brew_version" >> ${GITHUB_ENV} + brew_version="${GITHUB_REF:10}" + echo "brew_version=${brew_version}" >> "${GITHUB_ENV}" echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | docker login ghcr.io -u BrewTestBot --password-stdin - docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:$brew_version" - docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:$brew_version" + docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:${brew_version}" + docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:${brew_version}" docker tag brew "ghcr.io/homebrew/ubuntu${{matrix.version}}:latest" docker push "ghcr.io/homebrew/ubuntu${{matrix.version}}:latest" @@ -46,19 +46,19 @@ jobs: if: startsWith(github.ref, 'refs/tags/') run: | echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | docker login -u brewtestbot --password-stdin - docker tag brew "homebrew/ubuntu${{matrix.version}}:$brew_version" - docker push "homebrew/ubuntu${{matrix.version}}:$brew_version" + docker tag brew "homebrew/ubuntu${{matrix.version}}:${brew_version}" + docker push "homebrew/ubuntu${{matrix.version}}:${brew_version}" docker tag brew "homebrew/ubuntu${{matrix.version}}:latest" docker push "homebrew/ubuntu${{matrix.version}}:latest" - name: Deploy the homebrew/brew Docker image to GitHub Packages and Docker Hub if: startsWith(github.ref, 'refs/tags/') && matrix.version == '20.04' run: | - docker tag brew "ghcr.io/homebrew/brew:$brew_version" - docker push "ghcr.io/homebrew/brew:$brew_version" + docker tag brew "ghcr.io/homebrew/brew:${brew_version}" + docker push "ghcr.io/homebrew/brew:${brew_version}" docker tag brew "ghcr.io/homebrew/brew:latest" docker push "ghcr.io/homebrew/brew:latest" - docker tag brew "homebrew/brew:$brew_version" - docker push "homebrew/brew:$brew_version" + docker tag brew "homebrew/brew:${brew_version}" + docker push "homebrew/brew:${brew_version}" docker tag brew "homebrew/brew:latest" docker push "homebrew/brew:latest" diff --git a/.github/workflows/sorbet.yml b/.github/workflows/sorbet.yml index ff8b18b8a8..93e93856dd 100644 --- a/.github/workflows/sorbet.yml +++ b/.github/workflows/sorbet.yml @@ -40,20 +40,23 @@ jobs: BRANCH="sorbet-files-update" echo "::set-output name=branch::${BRANCH}" - if git ls-remote --exit-code --heads origin "$BRANCH"; then - git checkout "$BRANCH" + if git ls-remote --exit-code --heads origin "${BRANCH}" + then + git checkout "${BRANCH}" git reset --hard origin/master else - git checkout --no-track -B "$BRANCH" origin/master + git checkout --no-track -B "${BRANCH}" origin/master fi - if brew typecheck --update --fail-if-not-changed; then - git add "$GITHUB_WORKSPACE/Library/Homebrew/sorbet" + if brew typecheck --update --fail-if-not-changed + then + git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet" git commit -m "sorbet: Update RBI files." \ -m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow." echo "::set-output name=committed::true" - PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state") - if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then + PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")" + if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]] + then echo "::set-output name=pull_request::true" fi fi diff --git a/.github/workflows/spdx.yml b/.github/workflows/spdx.yml index 3797770d1b..93b3504f7d 100644 --- a/.github/workflows/spdx.yml +++ b/.github/workflows/spdx.yml @@ -37,19 +37,22 @@ jobs: BRANCH="spdx-update" echo "::set-output name=branch::${BRANCH}" - if git ls-remote --exit-code --heads origin "$BRANCH"; then - git checkout "$BRANCH" + if git ls-remote --exit-code --heads origin "${BRANCH}" + then + git checkout "${BRANCH}" git reset --hard origin/master else - git checkout --no-track -B "$BRANCH" origin/master + git checkout --no-track -B "${BRANCH}" origin/master fi - if brew update-license-data --fail-if-not-changed; then - git add "$GITHUB_WORKSPACE/Library/Homebrew/data/spdx" + if brew update-license-data --fail-if-not-changed + then + git add "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx" git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)." echo "::set-output name=committed::true" - PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state") - if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then + PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")" + if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]] + then echo "::set-output name=pull_request::true" fi fi diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5ac89b1287..50301bb217 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -90,10 +90,10 @@ jobs: - name: Set up all Homebrew taps run: | HOMEBREW_REPOSITORY="$(brew --repo)" - HOMEBREW_CORE_REPOSITORY="$HOMEBREW_REPOSITORY/Library/Taps/homebrew/homebrew-core" - git -C "$HOMEBREW_CORE_REPOSITORY" remote add homebrew_core https://github.com/Homebrew/homebrew-core - git -C "$HOMEBREW_CORE_REPOSITORY" fetch homebrew_core || git -C "$HOMEBREW_CORE_REPOSITORY" fetch homebrew_core - git -C "$HOMEBREW_CORE_REPOSITORY" checkout --force -B master homebrew_core/master + HOMEBREW_CORE_REPOSITORY="${HOMEBREW_REPOSITORY}/Library/Taps/homebrew/homebrew-core" + git -C "${HOMEBREW_CORE_REPOSITORY}" remote add homebrew_core https://github.com/Homebrew/homebrew-core + git -C "${HOMEBREW_CORE_REPOSITORY}" fetch homebrew_core || git -C "${HOMEBREW_CORE_REPOSITORY}" fetch homebrew_core + git -C "${HOMEBREW_CORE_REPOSITORY}" checkout --force -B master homebrew_core/master brew tap homebrew/aliases brew tap homebrew/autoupdate @@ -111,7 +111,7 @@ jobs: brew update-reset Library/Taps/homebrew/homebrew-bundle # brew style doesn't like world writable directories - sudo chmod -R g-w,o-w "$HOMEBREW_REPOSITORY/Library/Taps" + sudo chmod -R g-w,o-w "${HOMEBREW_REPOSITORY}/Library/Taps" - name: Run brew style on homebrew-core run: brew style --display-cop-names homebrew/core @@ -178,11 +178,11 @@ jobs: - name: Deploy the Docker image to GitHub Packages and Docker Hub if: github.ref == 'refs/heads/master' run: | - echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | \ + echo ${{secrets.HOMEBREW_BREW_GITHUB_PACKAGES_TOKEN}} | docker login ghcr.io -u BrewTestBot --password-stdin docker tag brew "ghcr.io/homebrew/ubuntu16.04:master" docker push "ghcr.io/homebrew/ubuntu16.04:master" - echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | \ + echo ${{secrets.HOMEBREW_BREW_DOCKER_TOKEN}} | docker login -u brewtestbot --password-stdin docker tag brew "homebrew/ubuntu16.04:master" docker push "homebrew/ubuntu16.04:master" @@ -321,9 +321,10 @@ jobs: run: | # Retry multiple times when using BuildPulse to detect and submit # flakiness (because rspec-retry is disabled). - if [ -n "$HOMEBREW_BUILDPULSE_ACCESS_KEY_ID" ]; then - brew tests --online --coverage || \ - brew tests --online --coverage || \ + if [[ -n "${HOMEBREW_BUILDPULSE_ACCESS_KEY_ID}" ]] + then + brew tests --online --coverage || + brew tests --online --coverage || brew tests --online --coverage else brew tests --online --coverage diff --git a/.github/workflows/update-man-completions.yml b/.github/workflows/update-man-completions.yml index 71125d33c4..a5587eec1e 100644 --- a/.github/workflows/update-man-completions.yml +++ b/.github/workflows/update-man-completions.yml @@ -44,27 +44,31 @@ jobs: BRANCH=update-man-completions echo "::set-output name=branch::${BRANCH}" - if git ls-remote --exit-code --heads origin "$BRANCH"; then - git checkout "$BRANCH" + if git ls-remote --exit-code --heads origin "${BRANCH}" + then + git checkout "${BRANCH}" git reset --hard origin/master else - git checkout --no-track -B "$BRANCH" origin/master + git checkout --no-track -B "${BRANCH}" origin/master fi - if [ "${{github.event_name}}" != "push" ]; then + if [[ "${{github.event_name}}" != "push" ]] + then brew update-maintainers fi - if brew generate-man-completions --fail-if-not-changed; then - git add "$GITHUB_WORKSPACE/README.md" \ - "$GITHUB_WORKSPACE/docs/Manpage.md" \ - "$GITHUB_WORKSPACE/manpages/brew.1" \ - "$GITHUB_WORKSPACE/completions" + if brew generate-man-completions --fail-if-not-changed + then + git add "${GITHUB_WORKSPACE}/README.md" \ + "${GITHUB_WORKSPACE}/docs/Manpage.md" \ + "${GITHUB_WORKSPACE}/manpages/brew.1" \ + "${GITHUB_WORKSPACE}/completions" git commit -m "Update maintainers, manpage and completions." \ -m "Autogenerated by the [update-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/update-man-completions.yml) workflow." echo "::set-output name=committed::true" - PULL_REQUEST_STATE=$(gh pr view --json=state | jq -r ".state") - if [ "$PULL_REQUEST_STATE" != "OPEN" ]; then + PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")" + if [[ "${PULL_REQUEST_STATE}" != "OPEN" ]] + then echo "::set-output name=pull_request::true" fi fi diff --git a/.github/workflows/vendor-gems.yml b/.github/workflows/vendor-gems.yml index 0ffadcac95..d641b0e9de 100644 --- a/.github/workflows/vendor-gems.yml +++ b/.github/workflows/vendor-gems.yml @@ -51,7 +51,8 @@ jobs: run: | set -u - if [[ "${GEM_NAME}" == 'sorbet' ]]; then + if [[ "${GEM_NAME}" == 'sorbet' ]] + then brew vendor-gems --update sorbet,sorbet-runtime else brew vendor-gems @@ -63,8 +64,10 @@ jobs: run: | set -u - if brew typecheck --update --fail-if-not-changed; then - if git add Library/Homebrew/sorbet; then + if brew typecheck --update --fail-if-not-changed + then + if git add Library/Homebrew/sorbet + then git commit -m "Update RBI files for ${GEM_NAME}." fi diff --git a/.vscode/settings.json b/.vscode/settings.json index 20151d086d..9ebb6c4160 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,5 +2,5 @@ "ruby.rubocop.executePath": "Library/Homebrew/shims/gems/", "files.trimTrailingWhitespace": true, "editor.tabSize": 2, - "files.insertFinalNewline": true, + "files.insertFinalNewline": true } diff --git a/Dockerfile b/Dockerfile index 99cecbe7db..701fc09bed 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,7 +34,7 @@ RUN apt-get update \ USER linuxbrew COPY --chown=linuxbrew:linuxbrew . /home/linuxbrew/.linuxbrew/Homebrew -ENV PATH=/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:$PATH +ENV PATH="/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:${PATH}" WORKDIR /home/linuxbrew RUN mkdir -p \ diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 13d3c3a21c..b0bd5dbe33 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -17,10 +17,11 @@ esac # same file under the native architecture # These variables are set from the user environment. # shellcheck disable=SC2154 -if [[ "${HOMEBREW_CHANGE_ARCH_TO_ARM}" = "1" ]] && \ - [[ "${HOMEBREW_MACOS}" = "1" ]] && \ - [[ "$(sysctl -n hw.optional.arm64 2>/dev/null)" = "1" ]] && \ - [[ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" = "1" ]]; then +if [[ "${HOMEBREW_CHANGE_ARCH_TO_ARM}" == "1" ]] && + [[ "${HOMEBREW_MACOS}" == "1" ]] && + [[ "$(sysctl -n hw.optional.arm64 2>/dev/null)" == "1" ]] && + [[ "$(sysctl -n sysctl.proc_translated 2>/dev/null)" == "1" ]] +then exec arch -arm64e "${HOMEBREW_BREW_FILE}" "$@" fi @@ -55,15 +56,15 @@ HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}" # HOMEBREW_LIBRARY set by bin/brew # shellcheck disable=SC2249,SC2154 case "$*" in - --cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;; - --repository|--repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;; - --caskroom) echo "${HOMEBREW_PREFIX}/Caskroom"; exit 0 ;; - --cache) echo "${HOMEBREW_CACHE}"; exit 0 ;; - shellenv) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/shellenv.sh"; homebrew-shellenv; exit 0 ;; - formulae) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/formulae.sh"; homebrew-formulae; exit 0 ;; - casks) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/casks.sh"; homebrew-casks; exit 0 ;; + --cellar) echo "${HOMEBREW_CELLAR}"; exit 0 ;; + --repository | --repo) echo "${HOMEBREW_REPOSITORY}"; exit 0 ;; + --caskroom) echo "${HOMEBREW_PREFIX}/Caskroom"; exit 0 ;; + --cache) echo "${HOMEBREW_CACHE}"; exit 0 ;; + shellenv) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/shellenv.sh"; homebrew-shellenv; exit 0 ;; + formulae) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/formulae.sh"; homebrew-formulae; exit 0 ;; + casks) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/casks.sh"; homebrew-casks; exit 0 ;; # falls back to cmd/prefix.rb on a non-zero return - --prefix*) source "${HOMEBREW_LIBRARY}/Homebrew/prefix.sh"; homebrew-prefix "$@" && exit 0 ;; + --prefix*) source "${HOMEBREW_LIBRARY}/Homebrew/prefix.sh"; homebrew-prefix "$@" && exit 0 ;; esac ##### @@ -144,16 +145,16 @@ numeric() { } check-run-command-as-root() { - [[ "$(id -u)" = 0 ]] || return + [[ "$(id -u)" == 0 ]] || return # Allow Azure Pipelines/GitHub Actions/Docker/Concourse/Kubernetes to do everything as root (as it's normal there) [[ -f /proc/1/cgroup ]] && grep -E "azpl_job|actions_job|docker|garden|kubepods" -q /proc/1/cgroup && return # Homebrew Services may need `sudo` for system-wide daemons. - [[ "${HOMEBREW_COMMAND}" = "services" ]] && return + [[ "${HOMEBREW_COMMAND}" == "services" ]] && return # It's fine to run this as root as it's not changing anything. - [[ "${HOMEBREW_COMMAND}" = "--prefix" ]] && return + [[ "${HOMEBREW_COMMAND}" == "--prefix" ]] && return odie </dev/null)" ]] + if [[ -f "${repo_fetch_head}" ]] && + [[ -n "$(find "${repo_fetch_head}" -type f -mtime -"${HOMEBREW_AUTO_UPDATE_SECS}"s 2>/dev/null)" ]] then return fi @@ -244,7 +248,8 @@ update-preinstall() { # Colorize output on GitHub Actions. # This is set by the user environment. # shellcheck disable=SC2154 -if [[ -n "${GITHUB_ACTIONS}" ]]; then +if [[ -n "${GITHUB_ACTIONS}" ]] +then export HOMEBREW_COLOR="1" fi @@ -261,13 +266,13 @@ else export LC_ALL=C elif [[ "$(locale charmap)" != "UTF-8" ]] then - locales=$(locale -a) + locales="$(locale -a)" c_utf_regex='\bC\.(utf8|UTF-8)\b' en_us_regex='\ben_US\.(utf8|UTF-8)\b' utf_regex='\b[a-z][a-z]_[A-Z][A-Z]\.(utf8|UTF-8)\b' if [[ ${locales} =~ ${c_utf_regex} || ${locales} =~ ${en_us_regex} || ${locales} =~ ${utf_regex} ]] then - export LC_ALL=${BASH_REMATCH[0]} + export LC_ALL="${BASH_REMATCH[0]}" else export LC_ALL=C fi @@ -278,7 +283,7 @@ fi ##### odie as quickly as possible. ##### -if [[ "${HOMEBREW_PREFIX}" = "/" || "${HOMEBREW_PREFIX}" = "/usr" ]] +if [[ "${HOMEBREW_PREFIX}" == "/" || "${HOMEBREW_PREFIX}" == "/usr" ]] then # it may work, but I only see pain this route and don't want to support it odie "Cowardly refusing to continue at this prefix: ${HOMEBREW_PREFIX}" @@ -296,17 +301,16 @@ fi ##### # USER isn't always set so provide a fall back for `brew` and subprocesses. -export USER=${USER:-$(id -un)} +export USER="${USER:-$(id -un)}" # A depth of 1 means this command was directly invoked by a user. # Higher depths mean this command was invoked by another Homebrew command. -export HOMEBREW_COMMAND_DEPTH=$((HOMEBREW_COMMAND_DEPTH + 1)) +export HOMEBREW_COMMAND_DEPTH="$((HOMEBREW_COMMAND_DEPTH + 1))" # This is set by the user environment. # shellcheck disable=SC2154 -if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" && - -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] && - "${HOMEBREW_PREFIX}/opt/curl/bin/curl" --version >/dev/null +if [[ -n "${HOMEBREW_FORCE_BREWED_CURL}" && -x "${HOMEBREW_PREFIX}/opt/curl/bin/curl" ]] && + "${HOMEBREW_PREFIX}/opt/curl/bin/curl" --version >/dev/null then HOMEBREW_CURL="${HOMEBREW_PREFIX}/opt/curl/bin/curl" elif [[ -n "${HOMEBREW_DEVELOPER}" && -x "${HOMEBREW_CURL_PATH}" ]] @@ -318,9 +322,8 @@ fi # This is set by the user environment. # shellcheck disable=SC2154 -if [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && - -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] && - "${HOMEBREW_PREFIX}/opt/git/bin/git" --version >/dev/null +if [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] && + "${HOMEBREW_PREFIX}/opt/git/bin/git" --version >/dev/null then HOMEBREW_GIT="${HOMEBREW_PREFIX}/opt/git/bin/git" elif [[ -n "${HOMEBREW_DEVELOPER}" && -x "${HOMEBREW_GIT_PATH}" ]] @@ -344,7 +347,11 @@ HOMEBREW_CORE_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" HOMEBREW_CASK_REPOSITORY="${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" case "$*" in - --version|-v) source "${HOMEBREW_LIBRARY}/Homebrew/cmd/--version.sh"; homebrew-version; exit 0 ;; + --version | -v) + source "${HOMEBREW_LIBRARY}/Homebrew/cmd/--version.sh" + homebrew-version + exit 0 + ;; esac # shellcheck disable=SC2154 @@ -357,7 +364,7 @@ if [[ -n "${HOMEBREW_MACOS}" ]] then HOMEBREW_PRODUCT="Homebrew" HOMEBREW_SYSTEM="Macintosh" - [[ "${HOMEBREW_PROCESSOR}" = "x86_64" ]] && HOMEBREW_PROCESSOR="Intel" + [[ "${HOMEBREW_PROCESSOR}" == "x86_64" ]] && HOMEBREW_PROCESSOR="Intel" HOMEBREW_MACOS_VERSION="$(/usr/bin/sw_vers -productVersion)" # Don't change this from Mac OS X to match what macOS itself does in Safari on 10.12 HOMEBREW_OS_USER_AGENT_VERSION="Mac OS X ${HOMEBREW_MACOS_VERSION}" @@ -423,17 +430,19 @@ else curl_version_output="$(${HOMEBREW_CURL} --version 2>/dev/null)" curl_name_and_version="${curl_version_output%% (*}" # shellcheck disable=SC2248 - if [[ $(numeric "${curl_name_and_version##* }") -lt $(numeric "${HOMEBREW_MINIMUM_CURL_VERSION}") ]] + if [[ "$(numeric "${curl_name_and_version##* }")" -lt "$(numeric "${HOMEBREW_MINIMUM_CURL_VERSION}")" ]] then - message="Please update your system curl. + message="Please update your system curl. Minimum required version: ${HOMEBREW_MINIMUM_CURL_VERSION} Your curl version: ${curl_name_and_version##* } Your curl executable: $(type -p ${HOMEBREW_CURL})" - if [[ -z ${HOMEBREW_CURL_PATH} || -z ${HOMEBREW_DEVELOPER} ]]; then + if [[ -z ${HOMEBREW_CURL_PATH} || -z ${HOMEBREW_DEVELOPER} ]] + then HOMEBREW_SYSTEM_CURL_TOO_OLD=1 HOMEBREW_FORCE_BREWED_CURL=1 - if [[ -z ${HOMEBREW_CURL_WARNING} ]]; then + if [[ -z ${HOMEBREW_CURL_WARNING} ]] + then onoe "${message}" HOMEBREW_CURL_WARNING=1 fi @@ -448,17 +457,19 @@ Your curl executable: $(type -p ${HOMEBREW_CURL})" git_version_output="$(${HOMEBREW_GIT} --version 2>/dev/null)" # $extra is intentionally discarded. # shellcheck disable=SC2034 - IFS=. read -r major minor micro build extra <<< "${git_version_output##* }" + IFS='.' read -r major minor micro build extra <<<"${git_version_output##* }" # shellcheck disable=SC2248 - if [[ $(numeric "${major}.${minor}.${micro}.${build}") -lt $(numeric "${HOMEBREW_MINIMUM_GIT_VERSION}") ]] + if [[ "$(numeric "${major}.${minor}.${micro}.${build}")" -lt "$(numeric "${HOMEBREW_MINIMUM_GIT_VERSION}")" ]] then message="Please update your system Git. Minimum required version: ${HOMEBREW_MINIMUM_GIT_VERSION} Your Git version: ${major}.${minor}.${micro}.${build} Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})" - if [[ -z ${HOMEBREW_GIT_PATH} || -z ${HOMEBREW_DEVELOPER} ]]; then + if [[ -z ${HOMEBREW_GIT_PATH} || -z ${HOMEBREW_DEVELOPER} ]] + then HOMEBREW_FORCE_BREWED_GIT="1" - if [[ -z ${HOMEBREW_GIT_WARNING} ]]; then + if [[ -z ${HOMEBREW_GIT_WARNING} ]] + then onoe "${message}" HOMEBREW_GIT_WARNING=1 fi @@ -471,7 +482,7 @@ Your Git executable: $(unset git && type -p ${HOMEBREW_GIT})" unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH HOMEBREW_CORE_REPOSITORY_ORIGIN="$("${HOMEBREW_GIT}" -C "${HOMEBREW_CORE_REPOSITORY}" remote get-url origin)" - if [[ "${HOMEBREW_CORE_REPOSITORY_ORIGIN}" = "https://github.com/Homebrew/homebrew-core" ]] + if [[ "${HOMEBREW_CORE_REPOSITORY_ORIGIN}" == "https://github.com/Homebrew/homebrew-core" ]] then # If the remote origin has been set to Homebrew/homebrew-core by the install script, # then we are in the case of a new installation of brew, using Homebrew/homebrew-core as a Linux core repository. @@ -490,12 +501,15 @@ fi # That will be when macOS 12 is the minimum required version. # HOMEBREW_BOTTLE_DOMAIN is set from the user environment # shellcheck disable=SC2154 -if [[ -n "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" && "${HOMEBREW_BOTTLE_DOMAIN}" = "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" ]] +if [[ -n "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" ]] && + [[ "${HOMEBREW_BOTTLE_DOMAIN}" == "${HOMEBREW_BOTTLE_DEFAULT_DOMAIN}" ]] then unset HOMEBREW_BOTTLE_DOMAIN fi -if [[ -n "${HOMEBREW_MACOS}" || -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" || -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]] +if [[ -n "${HOMEBREW_MACOS}" ]] || + [[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]] || + [[ -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]] then HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://ghcr.io/v2/homebrew/core" else @@ -535,8 +549,8 @@ export HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH if [[ -n "${HOMEBREW_MACOS}" && -x "/usr/bin/xcode-select" ]] then - XCODE_SELECT_PATH=$('/usr/bin/xcode-select' --print-path 2>/dev/null) - if [[ "${XCODE_SELECT_PATH}" = "/" ]] + XCODE_SELECT_PATH="$('/usr/bin/xcode-select' --print-path 2>/dev/null)" + if [[ "${XCODE_SELECT_PATH}" == "/" ]] then odie </dev/null)" - if [[ "${HOMEBREW_GIT_CONFIG_DEVELOPERMODE}" = "true" ]] + if [[ "${HOMEBREW_GIT_CONFIG_DEVELOPERMODE}" == "true" ]] then export HOMEBREW_DEV_CMD_RUN="1" fi @@ -635,7 +649,9 @@ then fi export HOMEBREW_BREW_GIT_REMOTE -if [[ -n "${HOMEBREW_MACOS}" ]] || [[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]] || [[ -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]] +if [[ -n "${HOMEBREW_MACOS}" ]] || + [[ -n "${HOMEBREW_FORCE_HOMEBREW_ON_LINUX}" ]] || + [[ -n "${HOMEBREW_FORCE_HOMEBREW_CORE_REPO_ON_LINUX}" ]] then HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/homebrew-core" else @@ -676,9 +692,9 @@ check-run-command-as-root check-prefix-is-not-tmpdir # shellcheck disable=SC2250 -if [[ "${HOMEBREW_PREFIX}" = "/usr/local" && - "${HOMEBREW_PREFIX}" != "${HOMEBREW_REPOSITORY}" && - "${HOMEBREW_CELLAR}" = "${HOMEBREW_REPOSITORY}/Cellar" ]] +if [[ "${HOMEBREW_PREFIX}" == "/usr/local" ]] && + [[ "${HOMEBREW_PREFIX}" != "${HOMEBREW_REPOSITORY}" ]] && + [[ "${HOMEBREW_CELLAR}" == "${HOMEBREW_REPOSITORY}/Cellar" ]] then cat >&2 </dev/null; then +if /bin/rmdir -- "${@}" &>/dev/null +then exit fi -for path in "${@}"; do +for path in "${@}" +do symlink=true [[ -L "${path}" ]] || symlink=false directory=false - if [[ -d "${path}" ]]; then + if [[ -d "${path}" ]] + then directory=true - if [[ -e "${path}/.DS_Store" ]]; then + if [[ -e "${path}/.DS_Store" ]] + then /bin/rm -- "${path}/.DS_Store" fi # Some packages leave broken symlinks around; we clean them out before # attempting to `rmdir` to prevent extra cruft from accumulating. /usr/bin/find -f "${path}" -- -mindepth 1 -maxdepth 1 -type l ! -exec /bin/test -e {} \; -delete - elif ! ${symlink} && [[ ! -e "${path}" ]]; then + elif ! ${symlink} && [[ ! -e "${path}" ]] + then # Skip paths that don't exists and aren't a broken symlink. continue fi - if ${symlink}; then + if ${symlink} + then # Delete directory symlink. /bin/rm -- "${path}" - elif ${directory}; then + elif ${directory} + then # Delete directory if empty. /usr/bin/find -f "${path}" -- -maxdepth 0 -type d -empty -exec /bin/rmdir -- {} \; else diff --git a/Library/Homebrew/cmd/--version.sh b/Library/Homebrew/cmd/--version.sh index bcd2d21264..caf3ea6257 100644 --- a/Library/Homebrew/cmd/--version.sh +++ b/Library/Homebrew/cmd/--version.sh @@ -6,20 +6,22 @@ # shellcheck disable=SC2154 version_string() { local repo="$1" - if ! [ -d "${repo}" ]; then + if ! [[ -d "${repo}" ]] + then echo "N/A" return fi local pretty_revision pretty_revision="$(git -C "${repo}" rev-parse --short --verify --quiet HEAD)" - if [ -z "${pretty_revision}" ]; then + if [[ -z "${pretty_revision}" ]] + then echo "(no Git repository)" return fi local git_last_commit_date - git_last_commit_date=$(git -C "${repo}" show -s --format='%cd' --date=short HEAD) + git_last_commit_date="$(git -C "${repo}" show -s --format='%cd' --date=short HEAD)" echo "(git revision ${pretty_revision}; last commit ${git_last_commit_date})" } @@ -27,7 +29,8 @@ homebrew-version() { echo "Homebrew ${HOMEBREW_VERSION}" echo "Homebrew/homebrew-core $(version_string "${HOMEBREW_CORE_REPOSITORY}")" - if [ -d "${HOMEBREW_CASK_REPOSITORY}" ]; then + if [[ -d "${HOMEBREW_CASK_REPOSITORY}" ]] + then echo "Homebrew/homebrew-cask $(version_string "${HOMEBREW_CASK_REPOSITORY}")" fi } diff --git a/Library/Homebrew/cmd/shellenv.sh b/Library/Homebrew/cmd/shellenv.sh index 4ed9ecb6e8..89b3ae8e06 100644 --- a/Library/Homebrew/cmd/shellenv.sh +++ b/Library/Homebrew/cmd/shellenv.sh @@ -4,14 +4,14 @@ #: #: The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times. #: The variable `HOMEBREW_SHELLENV_PREFIX` will be exported to avoid adding duplicate entries to the environment variables. -#: Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval $(brew shellenv)` +#: Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval "$(brew shellenv)"` # HOMEBREW_CELLAR and HOMEBREW_PREFIX are set by extend/ENV/super.rb # HOMEBREW_REPOSITORY is set by bin/brew # shellcheck disable=SC2154 homebrew-shellenv() { - [[ "${HOMEBREW_SHELLENV_PREFIX}" == "${HOMEBREW_PREFIX}" && - "$(PATH="${HOMEBREW_PATH}" command -v brew)" == "${HOMEBREW_PREFIX}/bin/brew" ]] && return + [[ "${HOMEBREW_SHELLENV_PREFIX}" == "${HOMEBREW_PREFIX}" ]] && + [[ "$(PATH="${HOMEBREW_PATH}" command -v brew)" == "${HOMEBREW_PREFIX}/bin/brew" ]] && return case "$(/bin/ps -p "${PPID}" -c -o comm=)" in fish | -fish) diff --git a/Library/Homebrew/cmd/update-reset.sh b/Library/Homebrew/cmd/update-reset.sh index 008d6d691f..fb7a99c193 100644 --- a/Library/Homebrew/cmd/update-reset.sh +++ b/Library/Homebrew/cmd/update-reset.sh @@ -11,10 +11,10 @@ homebrew-update-reset() { for option in "$@" do case "${option}" in - -\?|-h|--help|--usage) brew help update-reset; exit $? ;; - --debug) HOMEBREW_DEBUG=1 ;; + -\? | -h | --help | --usage) brew help update-reset; exit $? ;; + --debug) HOMEBREW_DEBUG=1 ;; -*) - [[ "${option}" = *d* ]] && HOMEBREW_DEBUG=1 + [[ "${option}" == *d* ]] && HOMEBREW_DEBUG=1 ;; *) REPOS+=("${option}") diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh index a062c8edb5..595c8042f5 100644 --- a/Library/Homebrew/cmd/update.sh +++ b/Library/Homebrew/cmd/update.sh @@ -77,7 +77,7 @@ repo_var() { local repo_var repo_var="$1" - if [[ "${repo_var}" = "${HOMEBREW_REPOSITORY}" ]] + if [[ "${repo_var}" == "${HOMEBREW_REPOSITORY}" ]] then repo_var="" else @@ -193,16 +193,18 @@ merge_or_rebase() { trap reset_on_interrupt SIGINT - if [[ "${DIR}" = "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]] + if [[ "${DIR}" == "${HOMEBREW_REPOSITORY}" && -n "${HOMEBREW_UPDATE_TO_TAG}" ]] then - UPSTREAM_TAG="$(git tag --list | - sort --field-separator=. --key=1,1nr -k 2,2nr -k 3,3nr | - grep --max-count=1 '^[0-9]*\.[0-9]*\.[0-9]*$')" + UPSTREAM_TAG="$( + git tag --list | + sort --field-separator=. --key=1,1nr -k 2,2nr -k 3,3nr | + grep --max-count=1 '^[0-9]*\.[0-9]*\.[0-9]*$' + )" else UPSTREAM_TAG="" fi - if [ -n "${UPSTREAM_TAG}" ] + if [[ -n "${UPSTREAM_TAG}" ]] then REMOTE_REF="refs/tags/${UPSTREAM_TAG}" UPSTREAM_BRANCH="stable" @@ -288,8 +290,8 @@ EOS if [[ -n "${HOMEBREW_NO_UPDATE_CLEANUP}" ]] then - if [[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" && - ! "${INITIAL_BRANCH}" =~ ^v[0-9]+\.[0-9]+\.[0-9]|stable$ ]] + if [[ "${INITIAL_BRANCH}" != "${UPSTREAM_BRANCH}" && -n "${INITIAL_BRANCH}" ]] && + [[ ! "${INITIAL_BRANCH}" =~ ^v[0-9]+\.[0-9]+\.[0-9]|stable$ ]] then git checkout "${INITIAL_BRANCH}" "${QUIET_ARGS[@]}" fi @@ -310,7 +312,7 @@ homebrew-update() { for option in "$@" do case "${option}" in - -\?|-h|--help|--usage) brew help update; exit $? ;; + -\? | -h | --help | --usage) brew help update; exit $? ;; --verbose) HOMEBREW_VERBOSE=1 ;; --debug) HOMEBREW_DEBUG=1 ;; --quiet) HOMEBREW_QUIET=1 ;; @@ -320,10 +322,10 @@ homebrew-update() { --preinstall) export HOMEBREW_UPDATE_PREINSTALL=1 ;; --*) ;; -*) - [[ "${option}" = *v* ]] && HOMEBREW_VERBOSE=1 - [[ "${option}" = *q* ]] && HOMEBREW_QUIET=1 - [[ "${option}" = *d* ]] && HOMEBREW_DEBUG=1 - [[ "${option}" = *f* ]] && HOMEBREW_UPDATE_FORCE=1 + [[ "${option}" == *v* ]] && HOMEBREW_VERBOSE=1 + [[ "${option}" == *q* ]] && HOMEBREW_QUIET=1 + [[ "${option}" == *d* ]] && HOMEBREW_DEBUG=1 + [[ "${option}" == *f* ]] && HOMEBREW_UPDATE_FORCE=1 ;; *) odie </dev/null || - [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && - ! -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] + [[ -n "${HOMEBREW_FORCE_BREWED_GIT}" && ! -x "${HOMEBREW_PREFIX}/opt/git/bin/git" ]] then # we cannot install a Homebrew Git if homebrew/core is unavailable. if [[ ! -d "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" ]] || ! brew install git @@ -394,7 +394,7 @@ EOS [[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core/.git/shallow" ]] && HOMEBREW_CORE_SHALLOW=1 [[ -f "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask/.git/shallow" ]] && HOMEBREW_CASK_SHALLOW=1 - if [[ -n ${HOMEBREW_CORE_SHALLOW} && -n ${HOMEBREW_CASK_SHALLOW} ]] + if [[ -n "${HOMEBREW_CORE_SHALLOW}" && -n "${HOMEBREW_CASK_SHALLOW}" ]] then SHALLOW_COMMAND_PHRASE="These commands" SHALLOW_REPO_PHRASE="repositories" @@ -403,7 +403,7 @@ EOS SHALLOW_REPO_PHRASE="repository" fi - if [[ -n ${HOMEBREW_CORE_SHALLOW} || -n ${HOMEBREW_CASK_SHALLOW} ]] + if [[ -n "${HOMEBREW_CORE_SHALLOW}" || -n "${HOMEBREW_CASK_SHALLOW}" ]] then odie <&2 - if [[ "${UPSTREAM_SHA_HTTP_CODE}" = "404" ]] + if [[ "${UPSTREAM_SHA_HTTP_CODE}" == "404" ]] then TAP="${DIR#${HOMEBREW_LIBRARY}/Taps/}" echo "${TAP} does not exist! Run \`brew untap ${TAP}\` to remove it." >>"${update_failed_file}" @@ -614,7 +615,7 @@ EOS echo "Fetching ${DIR} failed!" >>"${update_failed_file}" if [[ -f "${tmp_failure_file}" ]] && - [[ "$(<"${tmp_failure_file}")" = "fatal: couldn't find remote ref refs/heads/${UPSTREAM_BRANCH_DIR}" ]] + [[ "$(cat "${tmp_failure_file}")" == "fatal: couldn't find remote ref refs/heads/${UPSTREAM_BRANCH_DIR}" ]] then echo "${DIR}" >>"${missing_remote_ref_dirs_file}" fi @@ -638,7 +639,7 @@ EOS if [[ -f "${missing_remote_ref_dirs_file}" ]] then - HOMEBREW_MISSING_REMOTE_REF_DIRS="$(<"${missing_remote_ref_dirs_file}")" + HOMEBREW_MISSING_REMOTE_REF_DIRS="$(cat "${missing_remote_ref_dirs_file}")" rm -f "${missing_remote_ref_dirs_file}" export HOMEBREW_MISSING_REMOTE_REF_DIRS fi @@ -647,9 +648,10 @@ EOS do # HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell. # shellcheck disable=SC2031 - if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] && [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] && - [[ "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" || - "${DIR}" = "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" ]] + if [[ -n "${HOMEBREW_INSTALL_FROM_API}" ]] && + [[ -n "${HOMEBREW_UPDATE_PREINSTALL}" ]] && + [[ "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-core" || \ + "${DIR}" == "${HOMEBREW_LIBRARY}/Taps/homebrew/homebrew-cask" ]] then continue fi @@ -672,8 +674,8 @@ EOS then simulate_from_current_branch "${DIR}" "${TAP_VAR}" "${UPSTREAM_BRANCH}" "${CURRENT_REVISION}" elif [[ -z "${HOMEBREW_UPDATE_FORCE}" ]] && - [[ "${PREFETCH_REVISION}" = "${POSTFETCH_REVISION}" ]] && - [[ "${CURRENT_REVISION}" = "${POSTFETCH_REVISION}" ]] + [[ "${PREFETCH_REVISION}" == "${POSTFETCH_REVISION}" ]] && + [[ "${CURRENT_REVISION}" == "${POSTFETCH_REVISION}" ]] then export HOMEBREW_UPDATE_BEFORE"${TAP_VAR}"="${CURRENT_REVISION}" export HOMEBREW_UPDATE_AFTER"${TAP_VAR}"="${CURRENT_REVISION}" @@ -687,18 +689,17 @@ EOS # HOMEBREW_UPDATE_PREINSTALL wasn't modified in subshell. # shellcheck disable=SC2031 - if [[ -n "${HOMEBREW_UPDATED}" || - -n "${HOMEBREW_UPDATE_FAILED}" || - -n "${HOMEBREW_MISSING_REMOTE_REF_DIRS}" || - -n "${HOMEBREW_UPDATE_FORCE}" || - -d "${HOMEBREW_LIBRARY}/LinkedKegs" || - ! -f "${HOMEBREW_CACHE}/all_commands_list.txt" || - (-n "${HOMEBREW_DEVELOPER}" && -z "${HOMEBREW_UPDATE_PREINSTALL}") ]] + if [[ -n "${HOMEBREW_UPDATED}" ]] || + [[ -n "${HOMEBREW_UPDATE_FAILED}" ]] || + [[ -n "${HOMEBREW_MISSING_REMOTE_REF_DIRS}" ]] || + [[ -n "${HOMEBREW_UPDATE_FORCE}" ]] || + [[ -d "${HOMEBREW_LIBRARY}/LinkedKegs" ]] || + [[ ! -f "${HOMEBREW_CACHE}/all_commands_list.txt" ]] || + [[ -n "${HOMEBREW_DEVELOPER}" && -z "${HOMEBREW_UPDATE_PREINSTALL}" ]] then brew update-report "$@" return $? - elif [[ -z "${HOMEBREW_UPDATE_PREINSTALL}" && - -z "${HOMEBREW_QUIET}" ]] + elif [[ -z "${HOMEBREW_UPDATE_PREINSTALL}" && -z "${HOMEBREW_QUIET}" ]] then echo "Already up-to-date." fi diff --git a/Library/Homebrew/cmd/vendor-install.sh b/Library/Homebrew/cmd/vendor-install.sh index 3d0b0797ef..4d436ee9a8 100644 --- a/Library/Homebrew/cmd/vendor-install.sh +++ b/Library/Homebrew/cmd/vendor-install.sh @@ -14,7 +14,7 @@ VENDOR_DIR="${HOMEBREW_LIBRARY}/Homebrew/vendor" # Built from https://github.com/Homebrew/homebrew-portable-ruby. if [[ -n "${HOMEBREW_MACOS}" ]] then - if [[ "${HOMEBREW_PROCESSOR}" = "Intel" ]] + if [[ "${HOMEBREW_PROCESSOR}" == "Intel" ]] then ruby_FILENAME="portable-ruby-2.6.3_2.yosemite.bottle.tar.gz" ruby_SHA="b065e5e3783954f3e65d8d3a6377ca51649bfcfa21b356b0dd70490f74c6bd86" @@ -26,7 +26,7 @@ then ruby_FILENAME="portable-ruby-2.6.3_2.x86_64_linux.bottle.tar.gz" ruby_SHA="97e639a64dcec285392b53ad804b5334c324f1d2a8bdc2b5087b8bf8051e332f" ;; - *) + *) ;; esac fi @@ -43,13 +43,15 @@ then then ruby_URLs+=("${HOMEBREW_BOTTLE_DOMAIN}/bottles-portable-ruby/${ruby_FILENAME}") fi - ruby_URLs+=("https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}" - "https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_2/${ruby_FILENAME}") + ruby_URLs+=( + "https://ghcr.io/v2/homebrew/portable-ruby/portable-ruby/blobs/sha256:${ruby_SHA}" + "https://github.com/Homebrew/homebrew-portable-ruby/releases/download/2.6.3_2/${ruby_FILENAME}" + ) ruby_URL="${ruby_URLs[0]}" fi check_linux_glibc_version() { - if [[ -z ${HOMEBREW_LINUX} || -z ${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION} ]] + if [[ -z "${HOMEBREW_LINUX}" || -z "${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION}" ]] then return 0 fi @@ -58,15 +60,15 @@ check_linux_glibc_version() { local glibc_version_major local glibc_version_minor - local minimum_required_major=${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION%.*} - local minimum_required_minor=${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION#*.} + local minimum_required_major="${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION%.*}" + local minimum_required_minor="${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION#*.}" - if [[ $(/usr/bin/ldd --version) =~ \ [0-9]\.[0-9]+ ]] + if [[ "$(/usr/bin/ldd --version)" =~ \ [0-9]\.[0-9]+ ]] then - glibc_version=${BASH_REMATCH[0]// /} - glibc_version_major=${glibc_version%.*} - glibc_version_minor=${glibc_version#*.} - if (( glibc_version_major < minimum_required_major || glibc_version_minor < minimum_required_minor )) + glibc_version="${BASH_REMATCH[0]// /}" + glibc_version_major="${glibc_version%.*}" + glibc_version_minor="${glibc_version#*.}" + if ((glibc_version_major < minimum_required_major || glibc_version_minor < minimum_required_minor)) then odie "Vendored tools require system Glibc ${HOMEBREW_LINUX_MINIMUM_GLIBC_VERSION} or later (yours is ${glibc_version})." fi @@ -77,7 +79,8 @@ check_linux_glibc_version() { # Execute the specified command, and suppress stderr unless HOMEBREW_STDERR is set. quiet_stderr() { - if [[ -z "${HOMEBREW_STDERR}" ]]; then + if [[ -z "${HOMEBREW_STDERR}" ]] + then command "$@" 2>/dev/null else command "$@" @@ -180,13 +183,14 @@ EOS sha="$(sha256sum "${CACHED_LOCATION}" | cut -d' ' -f1)" elif [[ -x "$(type -P ruby)" ]] then - sha="$(ruby </dev/null) -if [[ -x "${exe}" && "${exe%/*}" != "${SUPERBIN}" ]]; then +exe="$(/usr/bin/xcrun --find "${arg0}" 2>/dev/null)" +if [[ -x "${exe}" && "${exe%/*}" != "${SUPERBIN}" ]] +then exec "${exe}" "$@" fi -old_IFS=${IFS} -IFS=: -for path in ${PATH}; do - if [ "${path}" = "${SUPERBIN}" ]; then +old_IFS="${IFS}" +IFS=':' +for path in ${PATH} +do + if [[ "${path}" == "${SUPERBIN}" ]] + then continue fi exe="${path}/${arg0}" - if [ -x "${exe}" ]; then + if [[ -x "${exe}" ]] + then exec "${exe}" "$@" fi done -IFS=${old_IFS} +IFS="${old_IFS}" echo >&2 " Failed to execute ${arg0} ${*} diff --git a/Library/Homebrew/shims/scm/git b/Library/Homebrew/shims/scm/git index 6cdadfd13b..a969376479 100755 --- a/Library/Homebrew/shims/scm/git +++ b/Library/Homebrew/shims/scm/git @@ -7,9 +7,9 @@ # SHIM_FILE is set by shims/utils.sh # HOMEBREW_GIT is set by brew.sh # HOMEBREW_SVN is from the user environment. -# HOMEBREW_PREFIX is set extend/ENV/super.rb +# HOMEBREW_PREFIX is set by extend/ENV/super.rb # shellcheck disable=SC2154 -if [ -z "${HOMEBREW_LIBRARY}" ] +if [[ -z "${HOMEBREW_LIBRARY}" ]] then echo "${0##*/}: This shim is internal and must be run via brew." >&2 exit 1 diff --git a/Library/Homebrew/shims/super/cc b/Library/Homebrew/shims/super/cc index fbe556f8b0..617d728a38 100755 --- a/Library/Homebrew/shims/super/cc +++ b/Library/Homebrew/shims/super/cc @@ -1,11 +1,11 @@ #!/bin/sh # Make sure this shim uses the same Ruby interpreter that is used by Homebrew. -if [ -z "$HOMEBREW_RUBY_PATH" ] +if [[ -z "${HOMEBREW_RUBY_PATH}" ]] then echo "${0##*/}: The build tool has reset ENV; --env=std required." >&2 exit 1 fi -exec "$HOMEBREW_RUBY_PATH" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -x "$0" "$@" +exec "${HOMEBREW_RUBY_PATH}" --enable-frozen-string-literal --disable=gems,did_you_mean,rubyopt -x "$0" "$@" #!/usr/bin/env ruby -W0 require "pathname" diff --git a/Library/Homebrew/shims/utils.sh b/Library/Homebrew/shims/utils.sh index 13e4d2be27..f573ed9fa0 100644 --- a/Library/Homebrew/shims/utils.sh +++ b/Library/Homebrew/shims/utils.sh @@ -1,7 +1,10 @@ set +o posix quiet_safe_cd() { - cd "$1" &>/dev/null || { echo "Error: failed to cd to $1" >&2; exit 1; } + cd "$1" &>/dev/null || { + echo "Error: failed to cd to $1" >&2 + exit 1 + } } absdir() { @@ -25,7 +28,7 @@ realpath() { while [[ -L "${path}" ]] do dest="$(readlink "${path}")" - if [[ "${dest}" = "/"* ]] + if [[ "${dest}" == "/"* ]] then path="${dest}" else @@ -54,11 +57,11 @@ safe_exec() { return fi # prevent fork-bombs - if [[ "$(lowercase "${arg0}")" = "${SHIM_FILE}" || "$(realpath "${arg0}")" = "${SHIM_REAL}" ]] + if [[ "$(lowercase "${arg0}")" == "${SHIM_FILE}" || "$(realpath "${arg0}")" == "${SHIM_REAL}" ]] then return fi - if [[ "${HOMEBREW}" = "print-path" ]] + if [[ "${HOMEBREW}" == "print-path" ]] then local dir dir="$(quiet_safe_cd "${arg0%/*}/" && pwd)" @@ -71,25 +74,23 @@ safe_exec() { } try_exec_non_system() { - local file="$1" + local file="$1" shift - IFS=$'\n' - for path in $(type -aP "${file}") - do - if [[ "${path}" != "/usr/bin/${file}" ]] - then - safe_exec "${path}" "$@" - fi - done - unset IFS + local path + while read -r path + do + if [[ "${path}" != "/usr/bin/${file}" ]] + then + safe_exec "${path}" "$@" + fi + done < <(type -aP "${file}") } - SHIM_FILE="${0##*/}" SHIM_REAL="$(realpath "$0")" -if [[ "$1" = --homebrew=* ]] +if [[ "$1" == "--homebrew="* ]] then HOMEBREW="${1:11}" shift diff --git a/Library/Homebrew/utils/analytics.sh b/Library/Homebrew/utils/analytics.sh index fe26e0bbed..62d38a01cb 100644 --- a/Library/Homebrew/utils/analytics.sh +++ b/Library/Homebrew/utils/analytics.sh @@ -10,7 +10,7 @@ migrate-legacy-uuid-file() { if [[ -f "${legacy_uuid_file}" ]] then - analytics_uuid="$(<"${legacy_uuid_file}")" + analytics_uuid="$(cat "${legacy_uuid_file}")" if [[ -n "${analytics_uuid}" ]] then git config --file="${HOMEBREW_REPOSITORY}/.git/config" --replace-all homebrew.analyticsuuid "${analytics_uuid}" 2>/dev/null @@ -32,7 +32,7 @@ setup-analytics() { local message_seen analytics_disabled message_seen="$(git config --file="${git_config_file}" --get homebrew.analyticsmessage 2>/dev/null)" analytics_disabled="$(git config --file="${git_config_file}" --get homebrew.analyticsdisabled 2>/dev/null)" - if [[ "${message_seen}" != "true" || "${analytics_disabled}" = "true" ]] + if [[ "${message_seen}" != "true" || "${analytics_disabled}" == "true" ]] then # Internal variable for brew's use, to differentiate from user-supplied setting export HOMEBREW_NO_ANALYTICS_THIS_RUN="1" diff --git a/Library/Homebrew/utils/lock.sh b/Library/Homebrew/utils/lock.sh index 010ea5ca14..8cc5f997ce 100644 --- a/Library/Homebrew/utils/lock.sh +++ b/Library/Homebrew/utils/lock.sh @@ -8,7 +8,7 @@ lock() { local lock_dir="${HOMEBREW_PREFIX}/var/homebrew/locks" local lock_file="${lock_dir}/${name}" [[ -d "${lock_dir}" ]] || mkdir -p "${lock_dir}" - if ! [[ -w "${lock_dir}" ]] + if [[ ! -w "${lock_dir}" ]] then odie < origin/master diff --git a/docs/Gems,-Eggs-and-Perl-Modules.md b/docs/Gems,-Eggs-and-Perl-Modules.md index 22ea9e0f1a..f50bfd0d65 100644 --- a/docs/Gems,-Eggs-and-Perl-Modules.md +++ b/docs/Gems,-Eggs-and-Perl-Modules.md @@ -118,7 +118,7 @@ Then put the appropriate incantation in your shell’s startup, e.g. for [`local::lib`](https://metacpan.org/pod/local::lib) docs. ```sh -eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib) +eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)" ``` Now (after you restart your shell) `cpan` or `perl -MCPAN -eshell` etc. diff --git a/docs/Homebrew-and-Python.md b/docs/Homebrew-and-Python.md index 68f030a9d2..a3514e32fb 100644 --- a/docs/Homebrew-and-Python.md +++ b/docs/Homebrew-and-Python.md @@ -77,7 +77,7 @@ For brewed Python, modules installed with `pip3` or `python3 setup.py install` w The system Python may not know which compiler flags to set in order to build bindings for software installed in Homebrew so you may need to run: ```sh -CFLAGS=-I$(brew --prefix)/include LDFLAGS=-L$(brew --prefix)/lib pip install +CFLAGS="-I$(brew --prefix)/include" LDFLAGS="-L$(brew --prefix)/lib" pip install ``` ## Virtualenv diff --git a/docs/Homebrew-linuxbrew-core-Maintainer-Guide.md b/docs/Homebrew-linuxbrew-core-Maintainer-Guide.md index 339fb9b921..882680975f 100644 --- a/docs/Homebrew-linuxbrew-core-Maintainer-Guide.md +++ b/docs/Homebrew-linuxbrew-core-Maintainer-Guide.md @@ -44,9 +44,9 @@ variable, or let `hub fork` add a remote for you. ```bash brew install hub -cd $(brew --repository homebrew/core) +cd "$(brew --repository homebrew/core)" git remote add homebrew https://github.com/Homebrew/homebrew-core.git -hub fork --remote-name=$HOMEBREW_GITHUB_USER +hub fork --remote-name="${HOMEBREW_GITHUB_USER}" ``` Now, let's make sure that our local branch `master` is clean and that @@ -56,7 +56,7 @@ your fork is up-to-date with Homebrew/linuxbrew-core: git checkout master git fetch origin master git reset --hard origin/master -git push --force $HOMEBREW_GITHUB_USER master +git push --force "${HOMEBREW_GITHUB_USER}" master ``` Strictly speaking, there is no need for `git reset --hard @@ -220,8 +220,9 @@ manually, tap `Homebrew/homebrew-linux-dev` and run the following command where the merge commit is `HEAD`: ```sh -for formula in $(brew find-formulae-to-bottle); do - brew request-bottle $formula +for formula in $(brew find-formulae-to-bottle) +do + brew request-bottle "${formula}" done ``` diff --git a/docs/Homebrew-on-Linux.md b/docs/Homebrew-on-Linux.md index fd22b35b39..23a99feca9 100644 --- a/docs/Homebrew-on-Linux.md +++ b/docs/Homebrew-on-Linux.md @@ -31,10 +31,10 @@ The prefix `/home/linuxbrew/.linuxbrew` was chosen so that users without admin a Follow the *Next steps* instructions to add Homebrew to your `PATH` and to your bash shell profile script, either `~/.profile` on Debian/Ubuntu or `~/.bash_profile` on CentOS/Fedora/Red Hat. ```sh -test -d ~/.linuxbrew && eval $(~/.linuxbrew/bin/brew shellenv) -test -d /home/linuxbrew/.linuxbrew && eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv) -test -r ~/.bash_profile && echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.bash_profile -echo "eval \$($(brew --prefix)/bin/brew shellenv)" >>~/.profile +test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)" +test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" +test -r ~/.bash_profile && echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.bash_profile +echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >>~/.profile ``` You're done! Try installing a package: @@ -86,7 +86,7 @@ Extract or `git clone` Homebrew wherever you want. Use `/home/linuxbrew/.linuxbr git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew mkdir ~/.linuxbrew/bin ln -s ~/.linuxbrew/Homebrew/bin/brew ~/.linuxbrew/bin -eval $(~/.linuxbrew/bin/brew shellenv) +eval "$(~/.linuxbrew/bin/brew shellenv)" ``` ## Homebrew on Linux Community diff --git a/docs/How-To-Open-a-Homebrew-Pull-Request.md b/docs/How-To-Open-a-Homebrew-Pull-Request.md index c34bb19b32..e9749b3706 100644 --- a/docs/How-To-Open-a-Homebrew-Pull-Request.md +++ b/docs/How-To-Open-a-Homebrew-Pull-Request.md @@ -15,7 +15,7 @@ Depending on the change you want to make, you need to send the pull request to t * This creates a personal remote repository that you can push to. This is needed because only Homebrew maintainers have push access to the main repositories. 2. Change to the directory containing your Homebrew installation: ```sh - cd $(brew --repository) + cd "$(brew --repository)" ``` 3. Add your pushable forked repository as a new remote: ```sh @@ -29,7 +29,7 @@ Depending on the change you want to make, you need to send the pull request to t * This creates a personal remote repository that you can push to. This is needed because only Homebrew maintainers have push access to the main repositories. 2. Change to the directory containing Homebrew formulae: ```sh - cd $(brew --repository homebrew/core) + cd "$(brew --repository homebrew/core)" ``` 3. Add your pushable forked repository as a new remote: ```sh diff --git a/docs/How-to-Build-Software-Outside-Homebrew-with-Homebrew-keg-only-Dependencies.md b/docs/How-to-Build-Software-Outside-Homebrew-with-Homebrew-keg-only-Dependencies.md index 724fa0c4e7..7bbd82d94c 100644 --- a/docs/How-to-Build-Software-Outside-Homebrew-with-Homebrew-keg-only-Dependencies.md +++ b/docs/How-to-Build-Software-Outside-Homebrew-with-Homebrew-keg-only-Dependencies.md @@ -27,13 +27,13 @@ Useful, reliable alternatives exist should you wish to use `keg_only` tools outs You can set flags to give configure scripts or Makefiles a nudge in the right direction. An example of flag setting: ```sh -./configure --prefix=/Users/Dave/Downloads CFLAGS=-I$(brew --prefix)/opt/openssl/include LDFLAGS=-L$(brew --prefix)/opt/openssl/lib +./configure --prefix=/Users/Dave/Downloads CFLAGS="-I$(brew --prefix)/opt/openssl/include" LDFLAGS="-L$(brew --prefix)/opt/openssl/lib" ``` An example using `pip`: ```sh -CFLAGS=-I$(brew --prefix)/opt/icu4c/include LDFLAGS=-L$(brew --prefix)/opt/icu4c/lib pip install pyicu +CFLAGS="-I$(brew --prefix)/opt/icu4c/include" LDFLAGS="-L$(brew --prefix)/opt/icu4c/lib" pip install pyicu ``` ### `PATH` modification @@ -41,7 +41,7 @@ CFLAGS=-I$(brew --prefix)/opt/icu4c/include LDFLAGS=-L$(brew --prefix)/opt/icu4c You can temporarily prepend your `PATH` with the tool’s `bin` directory, such as: ```sh -export PATH=$(brew --prefix)/opt/openssl/bin:$PATH +export PATH="$(brew --prefix)/opt/openssl/bin:${PATH}" ``` This will prepend that folder to your `PATH`, ensuring any build script that searches the `PATH` will find it first. @@ -55,7 +55,7 @@ If the tool you are attempting to build is [pkg-config](https://en.wikipedia.org An example of this is: ```sh -export PKG_CONFIG_PATH=$(brew --prefix)/opt/openssl/lib/pkgconfig +export PKG_CONFIG_PATH="$(brew --prefix)/opt/openssl/lib/pkgconfig" ``` If you’re curious about the `PKG_CONFIG_PATH` variable `man pkg-config` goes into more detail. diff --git a/docs/Manpage.md b/docs/Manpage.md index b3a118223e..0077a6517c 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -572,7 +572,7 @@ Print export statements. When run in a shell, this installation of Homebrew will The variables `HOMEBREW_PREFIX`, `HOMEBREW_CELLAR` and `HOMEBREW_REPOSITORY` are also exported to avoid querying them multiple times. The variable `HOMEBREW_SHELLENV_PREFIX` will be exported to avoid adding duplicate entries to the environment variables. -Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval $(brew shellenv)` +Consider adding evaluation of this command's output to your dotfiles (e.g. `~/.profile`, `~/.bash_profile`, or `~/.zprofile`) with: `eval "$(brew shellenv)"` ### `tap` [*`options`*] [*`user`*`/`*`repo`*] [*`URL`*] diff --git a/docs/Shell-Completion.md b/docs/Shell-Completion.md index e30de1f8f1..f1c2768dfe 100644 --- a/docs/Shell-Completion.md +++ b/docs/Shell-Completion.md @@ -13,13 +13,16 @@ Shell completions for external Homebrew commands are not automatically installed To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.bash_profile` (or, if it doesn't exist, `~/.profile`): ```sh -if type brew &>/dev/null; then +if type brew &>/dev/null +then HOMEBREW_PREFIX="$(brew --prefix)" - if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]; then + if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]] + then source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" else - for COMPLETION in "${HOMEBREW_PREFIX}/etc/bash_completion.d/"*; do - [[ -r "$COMPLETION" ]] && source "$COMPLETION" + for COMPLETION in "${HOMEBREW_PREFIX}/etc/bash_completion.d/"* + do + [[ -r "${COMPLETION}" ]] && source "${COMPLETION}" done fi fi @@ -35,8 +38,9 @@ If you are using the `bash` formula as your shell (i.e. `bash` >= v4) you should To make Homebrew's completions available in `zsh`, you must get the Homebrew-managed zsh site-functions on your `FPATH` before initialising `zsh`'s completion facility. Add the following to your `~/.zshrc` file: ```sh -if type brew &>/dev/null; then - FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH +if type brew &>/dev/null +then + FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" autoload -Uz compinit compinit @@ -46,7 +50,7 @@ fi This must be done before `compinit` is called. Note that if you are using Oh My Zsh, it will call `compinit` for you, so this must be done before you call `oh-my-zsh.sh`. This may be done by appending the following line to your `~/.zprofile` after Homebrew's initialization, instead of modifying your `~/.zshrc` as above: ```sh -FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH +FPATH="$(brew --prefix)/share/zsh/site-functions:${FPATH}" ``` You may also need to forcibly rebuild `zcompdump`: diff --git a/docs/Tips-N'-Tricks.md b/docs/Tips-N'-Tricks.md index c0491bce8d..1110862ff1 100644 --- a/docs/Tips-N'-Tricks.md +++ b/docs/Tips-N'-Tricks.md @@ -28,14 +28,14 @@ In the case of Erlang, this requires renaming the file from `otp_src_R13B03` to `brew --cache -s erlang` will print the correct name of the cached download. This means instead of manually renaming a formula, you can -run `mv the_tarball $(brew --cache -s )`. +run `mv the_tarball "$(brew --cache -s )"`. You can also pre-cache the download by using the command `brew fetch ` which also displays the SHA-256 hash. This can be useful for updating formulae to new versions. ## Installing stuff without the Xcode CLT ```sh -brew sh # or: eval $(brew --env) +brew sh # or: eval "$(brew --env)" gem install ronn # or c-programs ``` diff --git a/manpages/brew.1 b/manpages/brew.1 index 83f0533b60..c046ffa9b6 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "August 2021" "Homebrew" "brew" +.TH "BREW" "1" "September 2021" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The Missing Package Manager for macOS (or Linux) @@ -796,7 +796,7 @@ Search for \fItext\fR in the given database\. Print export statements\. When run in a shell, this installation of Homebrew will be added to your \fBPATH\fR, \fBMANPATH\fR, and \fBINFOPATH\fR\. . .P -The variables \fBHOMEBREW_PREFIX\fR, \fBHOMEBREW_CELLAR\fR and \fBHOMEBREW_REPOSITORY\fR are also exported to avoid querying them multiple times\. The variable \fBHOMEBREW_SHELLENV_PREFIX\fR will be exported to avoid adding duplicate entries to the environment variables\. Consider adding evaluation of this command\'s output to your dotfiles (e\.g\. \fB~/\.profile\fR, \fB~/\.bash_profile\fR, or \fB~/\.zprofile\fR) with: \fBeval $(brew shellenv)\fR +The variables \fBHOMEBREW_PREFIX\fR, \fBHOMEBREW_CELLAR\fR and \fBHOMEBREW_REPOSITORY\fR are also exported to avoid querying them multiple times\. The variable \fBHOMEBREW_SHELLENV_PREFIX\fR will be exported to avoid adding duplicate entries to the environment variables\. Consider adding evaluation of this command\'s output to your dotfiles (e\.g\. \fB~/\.profile\fR, \fB~/\.bash_profile\fR, or \fB~/\.zprofile\fR) with: \fBeval "$(brew shellenv)"\fR . .SS "\fBtap\fR [\fIoptions\fR] [\fIuser\fR\fB/\fR\fIrepo\fR] [\fIURL\fR]" Tap a formula repository\.