I was reading the marked answer from here : What is the difference between a builtin command and one that is not?
Here he says :
A built-in command is simply a command that the shell carries out itself, instead of interpreting it as a request to load and run some other program. This has two main effects. First, it's usually faster, because loading and running a program takes time. Of course, the longer the command takes to run, the less significant the load time is compared to the overall run time
Does it mean that when we run shell builtin commands like
echo , the shell (lets say bash) interprets it differently than running the program
cd from the path (/usr/bin/cd) which is obtained by using
I had thought that all commands that we execute run the corresponding programs. Seeing that answer has confused me.
If the shell doens't execute the program or file , then why does
which cd still returns the path of that program ? Doesn't it imply that when we run
echo hi command , it searches the paths in
PATH env variable to execute a program by name
Please explain this ....