2 replies
by smith_j100 Accepted solution
To change working directories, Bash executes the chdir system call, which changes the working directory of the calling process. The working directory is inherited by child processes.
To execute a program, Bash calls fork (or maybe vfork or some other variant), which creates a new “child” process that is nearly a copy of the original “parent” one. This child process then makes the execve system call, which replaces its own program with the program requested. Then Bash calls some version of the system call wait in order to wait until the child process terminates.
The reality is more complicated than this, since Bash also has to have some way of executing processes in the background, in subshells, and so on. It’s impossible to describe all of this in a single answer here.
by Johnharper2020 Accepted solution
Bash (Bourne Again Shell) is the free and enhanced version of the Bourne shell distributed with Linux and GNU operating systems. Bash is similar to the original, but has added features such as command-line editing.
Regards,
John
This discussion is closed to new replies.
Trending Linux posts
Sort by Trending