. ~/.profile...and boy things where ugly in the $PATH. So, how do you make things idempotent (able to be called mutliple times without side effects)? Well, your first modification to $PATH is probably something like:
export PATH=~/bin:$PATHThen you probably have a bunch of others like:
export PATH=/usr/local/heroku/bin:$PATHJust change that first one to this:
[[ -z "$PATH_ORIGINAL" ]] && export PATH_ORIGINAL=$PATHThat means you create $PATH_ORIGINAL once and only once. Then you use it as the starting point for all your path appendages later.
Try doing this before and after the change and see what you get... You may be shocked by the before.
for i in $(seq 10); do source .profile; done