I found this code in virtualenv activate
file:
# This should detect bash and zsh, which have a hash command that must
# be called to get it to forget past commands. Without forgetting
# past commands the $PATH changes we made may not be respected
if [ -n "${BASH-}" ] || [ -n "${ZSH_VERSION-}" ] ; then
hash -r 2>/dev/null
fi
hash -r 2
gives me an error in both bash and zsh. How does this code work? How does this code forget past commands?
Why might $PATH
changes not be respected if we don't forget the past commands? Can you show me some example?