if [ -z "$PATH_DEFAULT" ]; then
export PATH_DEFAULT="$PATH"
fi
export PATH="<stuff>:$PATH_DEFAULT:<other stuff>"
works in most any Bourne-derived shell. Having the _DEFAULT variables around comes in handy for clean build environments, as well (e.g., I build Emacs.app once and distribute it to several Macs, so I don't want configure to pull in random dependencies that just happen to be installed in MacPorts on my build machine).
Comments
Alternatively, just ensure sourcing .bash_profile is idempotent[1], then .bashrc can simply be
because, on all platforms, PS1 is non-empty on startup iff bash is interactive.[1] E.g., assuming PATH starts out non-empty, this
should work for PATH in bash much as works in most any Bourne-derived shell. Having the _DEFAULT variables around comes in handy for clean build environments, as well (e.g., I build Emacs.app once and distribute it to several Macs, so I don't want configure to pull in random dependencies that just happen to be installed in MacPorts on my build machine).