Issue
I'm using zsh and I'm trying to add a new entry (/home/david/pear/bin
) to the PATH
variable but I don't know how.
The thing that confuses me the most is that there's not a single
reference to a PATH
variable in my ~/.zshrc
file, but doing echo $PATH
returns:
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
So a PATH
variable is being set somewhere.
Solution
Here, add this line to .zshrc
:
export PATH=/home/david/pear/bin:$PATH
EDIT: This does work, but ony's answer below is better, as it takes advantage of the structured interface ZSH provides for variables like $PATH
. This approach is standard for bash
, but as far as I know, there is no reason to use it when ZSH provides better alternatives.
Answered By - Linuxios