You have now seen enough system calls to understand what needs to happen when the shell executes a simple command pipeline. Rather than examine the code for a real shell, which is just too complex to cover in any sensible way here, we will look at the code for a tiny shell which just has the bare essentials in place just enough to demonstrate some principles.
The tiny shell will present you with a prompt, in response to which you can type in any simple command followed by the parameters that the command requires. The tiny shell will execute your command and then return to you with another prompt. You should note that the tiny shell can cope with none of the regular expressions accepted by the real shell.
In addition to this simple scenario the tiny shell also allows you to use pipes and I/O redirection using the familiar |, <, > and >> operators, as well as allowing a pipeline to be executed in the background with the & operator.