Skip to content

Commit 33b5f9c

Browse files
committed
Alter PATH for login shells, not interactive shells
The installer was adding PATH exports to .bashrc/.zshrc, which are rc files for interactive shells. PATH belongs in login-shell startup files (~/.profile, ~/.bash_profile, ~/.zprofile) so it is set once per session and inherited by all child processes.
1 parent 9a0d581 commit 33b5f9c

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="$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)