One recommends me the following code apparently only in .zshrc without explaining its purpose clearly.
typeset -U PYTHONPATH
I am interested in how you can use the code in .bashrc. My Bash goes upset about the command.
How can you use the command in Bash?
That zsh command is useful because zsh can treat the environment variable PYTHONPATH as an actual array of paths. The -U
argument to typeset
says, then when representing the array in the environment value passed to the program (Python, in this case), only include the first instance of each unique value.
In bash, since array variables aren't exported, PYTHONPATH would be just a normal string variable, containing paths separated by colons. Hence, there is no need to tell bash to use only unique values.