Reputation: 579
I have been asked to find a shell command that doesn't make any system call. I have searched a lot and finally ended up here asking that is there any command in linux shell or unix that doesn't call a system call at the back end.
Thanks.
Upvotes: 0
Views: 890
Reputation: 146073
The Yes part...
There are a number of shell built-ins that handle control flow or definitions for the shell's macro processor programming language.
Only a few of the built-ins intrinsically need to make any system calls; in general they just change state inside the shell's memory image.
The No part...
You actually can't even just type Enter at the shell without having a number of system calls run. The shell might wait(2) to see if any children have terminated, it may check the time, it usually prints a prompt ... and of course it reads the next command.
Upvotes: 3
Reputation: 17169
Think of what a shell is, how does it run the commands.
The shell is an interpreter. Roughly speaking there is a single interpreter loop
do {
get_next_command();
switch(next_command){
cmd_alias: ...
cmd_break: ...
...
}
} while (true);
Now think, which command just updates the internal structures of the shell process and which command needs to call the operating system to perform its function.
Upvotes: 1