You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here is an example on how to do it (from Pulumi install script):
# Now that we have installed Pulumi, if it is not already on the path, let's add a line to the# user's profile to add the folder to the PATH for future sessions.if [ "${NO_EDIT_PATH}"!="true" ] &&!command -v pulumi >/dev/null;then# If we can, we'll add a line to the user's .profile adding ${PULUMI_INSTALL_ROOT}/bin to the PATH
SHELL_NAME=$(basename "${SHELL}")
PROFILE_FILE=""case"${SHELL_NAME}"in"bash")
# Terminal.app on macOS prefers .bash_profile to .bashrc, so we prefer that# file when trying to put our export into a profile. On *NIX, .bashrc is# preferred as it is sourced for new interactive shells.if [ "$(uname)"!="Darwin" ];thenif [ -e"${HOME}/.bashrc" ];then
PROFILE_FILE="${HOME}/.bashrc"elif [ -e"${HOME}/.bash_profile" ];then
PROFILE_FILE="${HOME}/.bash_profile"fielseif [ -e"${HOME}/.bash_profile" ];then
PROFILE_FILE="${HOME}/.bash_profile"elif [ -e"${HOME}/.bashrc" ];then
PROFILE_FILE="${HOME}/.bashrc"fifi
;;
"zsh")
if [ -e"${ZDOTDIR:-$HOME}/.zshrc" ];then
PROFILE_FILE="${ZDOTDIR:-$HOME}/.zshrc"fi
;;
esacif [ -n"${PROFILE_FILE}" ];then
LINE_TO_ADD="export PATH=\$PATH:${PULUMI_INSTALL_ROOT}/bin"if! grep -q "# add Pulumi to the PATH""${PROFILE_FILE}";then
say_white "+ Adding ${PULUMI_INSTALL_ROOT}/bin to \$PATH in ${PROFILE_FILE}"printf"\\n# add Pulumi to the PATH\\n%s\\n""${LINE_TO_ADD}">>"${PROFILE_FILE}"fi
EXTRA_INSTALL_STEP="+ Please restart your shell or add ${PULUMI_INSTALL_ROOT}/bin to your \$PATH"else
EXTRA_INSTALL_STEP="+ Please add ${PULUMI_INSTALL_ROOT}/bin to your \$PATH"fifi# Warn if the pulumi command is available, but it is in a different location from the current install root.if [ "$(command -v pulumi)"!="" ] && [ "$(command -v pulumi)"!="${PULUMI_INSTALL_ROOT}/bin/pulumi" ];then
say_yellow
say_yellow "warning: Pulumi has been installed to ${PULUMI_INSTALL_ROOT}/bin, but it looks like there's a different copy"
say_yellow " on your \$PATH at $(dirname "$(command -v pulumi)"). You'll need to explicitly invoke the"
say_yellow " version you just installed or modify your \$PATH to prefer this location."fi
The text was updated successfully, but these errors were encountered:
May I suggest not doing this? By all means print a message explaining how to add something to a user's path, but modifying dotfiles that aren't owned / created by secator is not really good practice imo. Many people will version control or manage their dotfiles with something like ansible, and tools making changes to this without permission is asking for trouble
Here is an example on how to do it (from Pulumi install script):
The text was updated successfully, but these errors were encountered: