@b0rk I believe all of the bash/zsh examples should be using quoted strings on the right hand side of the assignment:
export PATH="/some/dir:$PATH"
This is not always necessary but it's much easier and safer to always do it than to remember when it isn't necessary.
Unfortunately it has the side effect of blocking expansion of ~, so those need to get replaced with $HOME:
export PATH="$HOME/.npm-global/bin:$PATH"
@b0rk I'm being defensive, not against anything that might go wrong *here*, but against people picking up bad habits.
In bash and zsh (and the entire "Bourne shell" family) it *happens* to be safe to leave the double quotes off the right-hand side of an assignment, even if there is a variable in there that expands to something with spaces inside. Word splitting won't happen. But leaving the double quotes off *any* shell expression that contains variable expansions (or any other kind of expansion) is a bad habit to be in, because in *most* contexts word splitting *will* happen. It is better, in my opinion, not to try to remember when it won't, but instead to *always* double-quote unless you specifically *want* word splitting.
@zwol oh I see! I'm unlikely to tell people that they should quote $PATH in that case
(I'm sure that trying to prevent people from "picking up bad habits" is helpful sometimes but it feels kind of paternalistic to me and it's not really the kind of advice that I give)