Two variables represent the same list of folders but in different formats. The variable $PATH
is a string and the variable $path
is an array.
path
array# Append
path+=my/new/path
# Prepend
path=(my/new/path $path)
To avoid duplicate entries caused by the append method, use typeset -U
to keep only the first occurrence of each duplicated value. Check the Zsh command documentation.
typeset -U PATH path