A few days ago I was satisfied with my answer. I also knew that the
which command is not used to test whether a command exists. Now I'm not so satisfied with my answer, and I refer to this great response.
With a simple
And you can influence this with the order of the paths in your
$PATH or via an absolute path when the script starts, E.G.
If PATH is defined as below
And you start a script or something else which is in
/usr/local/bin and in
/usr/bin, the script in
/usr/local/bin as a higher priority.