How can I add in bash a test checking if a given directory (say /usr/local/bin) is already in a variable, say $PATH, before actually doing it?
Context: I am creating a script for a package I maintain for which I wish to include all steps to install dependencies. This involves changing the $PATH variable, but my question is more general (changes involve also $PYTHONPATH for instance). However, I wish also to not mingle with the existing variables and to not prepend it if it already exists.