Sometimes, usually when installing packages with brew
, I want to disable/remove certain parts of my path, and then later restore them. I haven't been able to find an easy way to do this, and while I could write my own bash script to do so, I'm wondering if there's an easier way.
Desired behavior (or something like it):
$ echo $PATH
/Users/mchenja/anaconda/bin:/usr/local/bin:/(and so on)
$ changepath "brew"; echo $PATH
/usr/local/bin:/(and so on)
$ changepath "anaconda"; echo $PATH
/Users/mchenja/anaconda/bin:/usr/local/bin:/(and so on)
Here, "brew" and "anaconda" are just user-defined keywords to manipulate a saved path.
Does bash offer a built-in method of doing this? What about an external add-on?