Shell as Command Line

a shell is also known as command line: it accepts commands from the user, usually in a line-oriented fashion

after accepting an input line, the shell has to determine the commands, options, and arguments issued by the user

this is done by a parsing component (e.g. parseline)

once the commands are identified, the shell sets up the communication infrastructure (e.g. via pipes), and then launches new processes to execute the commands via fork() and exec()

in most cases, the shell just waits until a command issued via a child process is completed

programs that are intended to run for a longer time period may be launched in the background, making the shell available to the user again

after a child process terminates, the shell needs to release the process via wait()

the user can terminate the shell, usually through a command such as exit, logout, quit or a special key combination such as Control-D