To parse a command line means to look at each part of the command line
and convert it into something that the computer can execute.
Since there variations in how different shells parse a command
line, it can be assumed for the rest of this section, that the shell
in question is generic.
For the purpose of this book the small differences between shells as
well as the exact precise details of parsing can be ignored.
When a user enters a command line at the prompt, the shell begins by
analyzing the command line.
The shell will break the command line down into small indivisible
pieces called tokens (sometimes they are refered to as atomic).
Each token is then analyzed in terms of its relationship with the
other tokens.
This is similar to the human examination of an english sentence.
If a noun is present, but no verb, the sentence is deemed incomplete.
The shell behaves in much the same matter.
It doesn't only check for missing bits, it also makes sure that what
is there is in correct order.
The shell may have to examine a command line more than once to collect
all of the tokens.
Each examination is called a pass.
The reason for multiple passes is that command lines can be quite
complicated, there can be all kinds of substitutions that need to be
made.
On each pass the shell will make a required substitution and then
collect the available tokens.
Since the substitutions can be nested (substitutions containing
substitutions), the shell may require several passes to collect all of
the tokens.
As stated above, if at this point in the process the shell determines
that the grammar of the command line is incorrect, an error is
displayed to the user, or else the command is executed.
While the actual order in which the tokens are gathered is
interesting, it is beyond the scope of this book.
Where required (such as aliases) the order of some of the
parsing procedure will be presented.