I often want to add paths to my $PATH
variable.
It’s nice to do this with functions (in your .zshrc
or .bashrc
file):
These will check if a) the directory exists and b) it isn’t already in your $PATH
, and then either append or prepend the path into your $PATH
variable.
Then you can put things like this in:
And if you execute your .bashrc
or .zshrc
multiple times, your $PATH
won’t grow.
Note: The functions above come almost directly from a superuser post.