Re:Show HN: Z shell configuration, zsh startup files, when t...
by rucikir on Thursday October 17, 2019 @05:57AM
(#21280362)
If something like `export PATH="aa:$PATH"` is written in `.zshenv`, as the file is sourced even for nested zsh sessions, a new `aa` will be prepended for each zsh level. Consider protecting that kind of expansion (if you use it) with `if [[ $SHLVL == 1 ]]; then ...; fi`.
[ Parent
| on HN ]
Re:Show HN: Z shell configuration, zsh startup files, when t...
by soraminazuki on Thursday October 17, 2019 @08:24AM
(#21281248)
‘typeset -U path’ would be a more simple alternative.
Re:Show HN: Z shell configuration, zsh startup files, when t...
by bloopernova on Thursday October 17, 2019 @12:08PM
(#21283480)
Yeah, I like this in zsh:
# Only allow unique entries in the PATH variable
typeset -U path
# Easier to read PATH variable modification:
path+=(
"${JAVA_HOME}/bin"
"${GOPATH}/bin"
)