/path/2/ both have executable files of the same name
In a nonlogin interactive shell, I would like to temporarily exchange the search order between the two directories.
Bash manual says for
The -p option inhibits the path search, and filename is used as the location of name.
My way is
$ hash -p /path/2/myexecutable hits command 3 /usr/bin/which 4 /usr/bin/psql 1 /bin/cat 10 /usr/bin/sudo 1 /bin/mv 1 /usr/bin/whereis 3 /bin/mkdir 19 /bin/ls
the output is the same as
hash, and it doesn't seem to change
myexecutable to be
$ which myexecutable /path/1/myexecutable
So what does
hash -p do actually?