mirror of
https://github.com/jbranchaud/til
synced 2026-01-03 15:18:01 +00:00
807 B
807 B
Add To Path Via Path Array
Typically when managing what is on your path in a Unix shell environment, you
override the PATH environment variable with export. This is usually an
append or prepend to bring along the existing path entries.
$ export PATH="$PATH:/Users/me/.local/bin"
The zsh shell environment exposes another way of adding to your path. They
have a path array which can be a little easier to work with since you can use
an array operation instead of string interpolation.
Here is how we'd do the same as above:
$ path+=/Users/me/.local/bin
This works because there is an automatic linking in zsh between arrays and colon-separated strings (scalars). source