cmd/shellenv: output the result of path_helper instead

This will save the indirection of `eval`.
This commit is contained in:
Carlo Cabrera 2024-09-02 17:34:34 +08:00
parent 43d10940b9
commit c9ca7e3257
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -50,7 +50,7 @@ homebrew-shellenv() {
echo "setenv HOMEBREW_REPOSITORY ${HOMEBREW_REPOSITORY};"
if [[ -n "${PATH_HELPER_ROOT}" ]]
then
echo "eval \`/usr/bin/env PATH_HELPER_ROOT=\"${PATH_HELPER_ROOT}\" /usr/libexec/path_helper -c\`;"
PATH_HELPER_ROOT="${PATH_HELPER_ROOT}" /usr/libexec/path_helper -c
else
echo "setenv PATH ${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin:\$PATH;"
fi
@ -71,7 +71,7 @@ homebrew-shellenv() {
echo "export HOMEBREW_REPOSITORY=\"${HOMEBREW_REPOSITORY}\";"
if [[ -n "${PATH_HELPER_ROOT}" ]]
then
echo "eval \"\$(PATH_HELPER_ROOT=\"${PATH_HELPER_ROOT}\" /usr/libexec/path_helper -s)\""
PATH_HELPER_ROOT="${PATH_HELPER_ROOT}" /usr/libexec/path_helper -s
else
echo "export PATH=\"${HOMEBREW_PREFIX}/bin:${HOMEBREW_PREFIX}/sbin\${PATH+:\$PATH}\";"
fi