I was playing around a bit with the names of some executables, putting them in a folder, ~/bin
, which is in my $PATH
. Now I'm wondering how I can set the preferences of a bash-3.2
terminal so that it picks up these executables instead of the builtins or aliases to execute.
For example, if I put a script named cd
in a directory in $PATH
, the builtin for cd
is still executed. However, if I create an alias
for cd
, then this alias will be executed, overriding the builtin.
$ type cd
cd is a shell builtin
My questions
Is there a way to make an executable file in
$PATH
have, by default, preference over a shell builtin, by executing only, e.g.cd
without having to resort to using the commandsbuiltin
orcommand
?I'm also interested in any official reference which discusses this preference (not the reasoning, that I do understand).
Note: This question is purely for personal educational purposes, I am wondering why it works the way it works.
command
answers. – Bernhard Feb 14 '14 at 13:27alias cd=/bin/cd
will override thecd
builtin. – terdon Feb 14 '14 at 14:26enable
in the answer is more the answer that I intended. – Bernhard Feb 14 '14 at 14:32