From 17855638c2535bbc74ed8270d64f774c6f9656ed Mon Sep 17 00:00:00 2001 From: Scott Searcy Date: Fri, 9 Aug 2024 17:35:30 -0700 Subject: [PATCH] Update Fish shell environment script Fish didn't support `$(...)` substitution until v3.4.0, but the command didn't work with just parenthesis, so rewrite the test to prepend an empty string if MANPATH is non-empty (to trigger a leading colon). Only manipulate INFOPATH in Fish if Homebrew not in path already. --- Library/Homebrew/cmd/shellenv.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/shellenv.sh b/Library/Homebrew/cmd/shellenv.sh index d9339ef615..3070a10b02 100644 --- a/Library/Homebrew/cmd/shellenv.sh +++ b/Library/Homebrew/cmd/shellenv.sh @@ -24,8 +24,8 @@ homebrew-shellenv() { echo "set -gx HOMEBREW_CELLAR \"${HOMEBREW_CELLAR}\";" echo "set -gx HOMEBREW_REPOSITORY \"${HOMEBREW_REPOSITORY}\";" echo "fish_add_path -gP \"${HOMEBREW_PREFIX}/bin\" \"${HOMEBREW_PREFIX}/sbin\";" - echo "set -q MANPATH; and set MANPATH[1] \":\$(string trim --left --chars=\":\" \$MANPATH[1])\";" - echo "! set -q INFOPATH; and set INFOPATH ''; set -gx INFOPATH \"${HOMEBREW_PREFIX}/share/info\" \$INFOPATH;" + echo "if test -n \"\$MANPATH[1]\"; set -gx MANPATH '' \$MANPATH; end;" + echo "if not contains \"${HOMEBREW_PREFIX}/share/info\" \$INFOPATH; set -gx INFOPATH \"${HOMEBREW_PREFIX}/share/info\" \$INFOPATH; end;" ;; csh | -csh | tcsh | -tcsh) echo "setenv HOMEBREW_PREFIX ${HOMEBREW_PREFIX};"