I notice that when I compile a custom build of a packaged program stored in /usr/bin
eg /usr/bin/emacs
, which emacs
shows the already existing executable at /usr/bin/emacs
instead /usr/local/bin/emacs
, although /usr/local/bin
occurs earlier in my PATH
.
I need to log in and log out, or open a new screen
frame before which emacs
shows the new binary.
Is that because of some caching, or is there some safety feature that causes the existing path to be referenced until logged in again?
EDIT:
For those who consider this question to be a duplicate or answered by other questions eg - How do I clear Bash's cache of paths to executables?, What is the purpose of the hash command?, this question asks specifically about a shell
, not about bash
, or the hash
commandbuilt into bash
(which I didn't know about) , inspite of it being the default shell on most systems.
There are other shells in existence eg, zsh
the one I use, fish
, ksh
, eshell
, ksh
and host of other new shells, eg oilshell
coming on to the market, so to speak.
So I think this question should stand on its own, being about shells in general, not one particular shell or the other.
If there is a rationale for this, experience has taught that it is the sensible option, or it has to do with economy or performance than other answers may elaborate on it.
I would have preferred this edit to be a comment, but they are limited in length.
bash
back then.But of late I'm doing a lot of compilation into
– vfclists Nov 08 '22 at 10:57/usr/local
which require me to start a new shell to use the newly installed versions, and I am also usingzsh
which is why I see it as ashell
thing, not abash
orzsh
thing.