How the shell works, from http://www.cs.duke.edu/courses/spring05/cps210/Lab1.html
The OS command interpreter is the program that people interact with in order to launch and control programs. On UNIX systems, the command interpreter is usually called the shell: it is a user-level program that gives people a command-line interface to launching, suspending, and killing other programs. sh, ksh, csh, tcsh, bash, ... are all examples of UNIX shells. (It might be useful to look at the manual pages of these shells, for example, type: "man csh".)
Every shell is structured as the following loop:
Although most of the commands people type on the prompt are the name of other UNIX programs (such as ls or more), shells recognize some special commands (called internal commands) which are not program names. For example, the exit command terminates the shell, and the cd command changes the current working directory. Shells directly make system calls to execute these commands, instead of forking a child process to handle them.
Additional Info for CS644
Similarly the cmd.exe program of Windows does a similar loop with CreateProcess for the specified program followed by waiting for the spawned process completion. Xinu has no command shell. If we want to run a certain program under Xinu, we build an executable with that certain program in it as its main.