1.4.1.1.
Shell syntax
Up one level
-
If input is not commented, the shell reads it and divides it into words and operators, employing quoting rules to define the meaning of each character of input. Then these words and operators are translated into commands and other constructs, which return an exit status available for inspection or processing. The above fork-and-exec scheme is only applied after the shell has analyzed input in the following way:
-
The shell reads its input from a file, from a string or from the user's terminal.
-
Input is broken up into words and operators, obeying the quoting rules, see Chapter 3. These tokens are separated by metacharacters. Alias expansion is performed.
-
The shell parses (analyzes and substitutes) the tokens into simple and compound commands.
-
Bash performs various shell expansions, breaking the expanded tokens into lists of filenames and commands and arguments.
-
Redirection is performed if necessary, redirection operators and their operands are removed from the argument list.
-
Commands are executed.
-
Optionally the shell waits for the command to complete and collects its exit status.

