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.
This commit is contained in:
Carlo Cabrera 2024-08-04 02:52:14 +08:00
parent 4dcd308398
commit 3fec77e72a
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -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)"