Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix grepping for direnv, add profile files to messages #2001

Merged
merged 1 commit into from
Nov 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix grepping for direnv, add profile files to messages
Because if one of the files ~/.bashrc, ~/.bash_profile didn't exist, but the other file contained the string "direnv", grep returned non-zero exit status.
  • Loading branch information
kukimik authored Sep 3, 2024
commit 20522b70b1fd573429bf19064d29b98ddbf1abcc
8 changes: 4 additions & 4 deletions ProjectGenerator/bin/ihp-new
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ if ! [ -x "$(command -v direnv)" ]; then
if [ $DIRENV_HOOK_ADDED = 0 ]; then
echo ""
echo "Please add the hook manually."
echo -e "Bash: Add \e[4meval \"\$(direnv hook bash)\"\e[0m to ~/.bashrc"
echo -e "ZSH: Add \e[4meval \"\$(direnv hook zsh)\"\e[0m to ~/.zshrc"
echo -e "Bash: Add \e[4meval \"\$(direnv hook bash)\"\e[0m to ~/.bashrc or ~/.bash_profile"
echo -e "ZSH: Add \e[4meval \"\$(direnv hook zsh)\"\e[0m to ~/.zshrc or ~/.zprofile"
echo "Other shells: See https://direnv.net/#README"
echo -e "\e[1mHave you hooked direnv into your shell? (Type y to proceed) \e[0m"
while true; do
Expand All @@ -160,12 +160,12 @@ fi
DIRENV_SETUP=0;
case "${SHELL##*/}" in
zsh )
if grep direnv "$HOME/.zshrc" "$HOME/.zprofile" 2>&1 >/dev/null; then
if grep -q -s direnv "$HOME/.zshrc" "$HOME/.zprofile"; then
DIRENV_SETUP=1;
fi;
;;
bash )
if grep direnv "$HOME/.bashrc" "$HOME/.bash_profile" 2>&1 >/dev/null; then
if grep -q -s direnv "$HOME/.bashrc" "$HOME/.bash_profile"; then
DIRENV_SETUP=1;
fi;
;;
Expand Down