From 3fec77e72aa8b46a8b5eab2da1f6af7e09c68bd7 Mon Sep 17 00:00:00 2001 From: Carlo Cabrera <30379873+carlocab@users.noreply.github.com> Date: Sun, 4 Aug 2024 02:52:14 +0800 Subject: [PATCH] shellenv: fix `MANPATH` and `INFOPATH` handling for [t]csh It turns out that control flow in csh is a pain. But we can rely on `test`, which is thankfully POSIX. Closes #17949. --- 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 3057d452daec9..d9339ef615b64 100644 --- a/Library/Homebrew/cmd/shellenv.sh +++ b/Library/Homebrew/cmd/shellenv.sh @@ -32,8 +32,8 @@ homebrew-shellenv() { echo "setenv HOMEBREW_CELLAR ${HOMEBREW_CELLAR};" echo "setenv HOMEBREW_REPOSITORY ${HOMEBREW_REPOSITORY};" echo "setenv PATH ${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:\$PATH;" - echo "if ( \${?MANPATH} == 1 ) setenv MANPATH :\${MANPATH};" - echo "setenv INFOPATH ${HOMEBREW_PREFIX}/share/info\`if ( \${?INFOPATH} == 1 ) echo \":\${INFOPATH}\"\`;" + echo "test \${?MANPATH} -eq 1 && setenv MANPATH :\${MANPATH};" + echo "setenv INFOPATH ${HOMEBREW_PREFIX}/share/info\`test \${?INFOPATH} -eq 1 && echo :\${INFOPATH}\`;" ;; pwsh | -pwsh | pwsh-preview | -pwsh-preview) echo "[System.Environment]::SetEnvironmentVariable('HOMEBREW_PREFIX','${HOMEBREW_PREFIX}',[System.EnvironmentVariableTarget]::Process)"