Hacker News new | past | comments | ask | show | jobs | submit login

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`.



‘typeset -U path’ would be a more simple alternative.


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"
    )




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: