Skip to content

Commit 894b48f

Browse files
authored
Merge pull request github#2004 from github/tpope/fix-install-shell-profile
Alter PATH for login shells, not interactive shells
2 parents 9a0d581 + 10fc284 commit 894b48f

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

install.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,19 @@ if ! command -v copilot >/dev/null 2>&1; then
151151
echo ""
152152
echo "Notice: $INSTALL_DIR is not in your PATH"
153153

154-
# Detect shell rc file
154+
# Detect shell profile file for PATH
155155
case "$(basename "${SHELL:-/bin/sh}")" in
156-
zsh) RC_FILE="$HOME/.zshrc" ;;
157-
bash) RC_FILE="$HOME/.bashrc" ;;
158-
*) RC_FILE="$HOME/.profile" ;;
156+
zsh) RC_FILE="${ZDOTDIR:-$HOME}/.zprofile" ;;
157+
bash)
158+
if [ -f "$HOME/.bash_profile" ]; then
159+
RC_FILE="$HOME/.bash_profile"
160+
elif [ -f "$HOME/.bash_login" ]; then
161+
RC_FILE="$HOME/.bash_login"
162+
else
163+
RC_FILE="$HOME/.profile"
164+
fi
165+
;;
166+
*) RC_FILE="$HOME/.profile" ;;
159167
esac
160168

161169
# Prompt user to add to shell rc file (only if interactive)

0 commit comments

Comments
 (0)