Go to the first, previous, next, last section, table of contents.


Execution

The words in a simple command are subjected to a number of substitutions, described later, but eventually becomes simply a list of assignment words, normal words, and I/O words. If all the I/O redirection required by the I/O words is successfully arranged, the shell attempts to execute the command. What is actually done is determined largely by the first of the simple words in the command body.

If this word contains any quoted characters, then only the final option - that of finding an executable file - is attempted, otherwise each of the following is tried in turn.

When a command terminates, it returns an exit-value to the shell which is usually used to indicate success or failure. This value is a positive integer less than 256 where a value of 0 indicates success and any other value indicates failure, the actual number depends on the program and the reason for failure. This number is made available through the $? parameter. Alternately, if a program terminates because it received a signal, the $? parameter is set to 1000 plus the signal number.

This value is also used by the if and while commands as well as the && and || command separators to control the execution of subsequent commands.


Go to the first, previous, next, last section, table of contents.