Store grep in a variable

This commit is contained in:
Aaron
2023-02-22 19:35:42 +00:00
parent 81caa76a40
commit 1c8f9f699c

View File

@@ -994,14 +994,17 @@ case "${SHELL}" in
;;
esac
in_shell_profile=$(grep -qs "eval \"\$(${HOMEBREW_PREFIX}/bin/brew shellenv)\"" "${shell_profile}")
# FIXME: figure out why this give a "command not found" error
# show different instructions on adding Homebrew to path based on if the user has already done so
if grep -qs "eval \"\$(${HOMEBREW_PREFIX}/bin/brew shellenv)\"" "${shell_profile}" && ! type brew &>/dev/null
if "$in_shell_profile" && ! type brew &>/dev/null
then
cat <<EOS
- Run this command in your terminal to add Homebrew to your ${tty_bold}PATH${tty_reset}:
eval "\$(${HOMEBREW_PREFIX}/bin/brew shellenv)"
EOS
elif ! grep -qs "eval \"\$(${HOMEBREW_PREFIX}/bin/brew shellenv)\"" "${shell_profile}"
elif ! "$in_shell_profile"
then
cat <<EOS
- Run these two commands in your terminal to add Homebrew to your ${tty_bold}PATH${tty_reset}: