Processing Commands by shells
Every shell creates subshells and their child processes-subordinate shells and processes which are executed inside the parent or originating, shell-to interpret and execute commands. For instance, the following list displays a simplified version of the order in that the Korne shell processes commands:
1. Parses (divides up) the command into units divided through the fixed set of meta characters: Space Tab Newline ;( ) < > | &. Types of units involve words, keywords, semicolons, I/O redirectors, and others.
2. Checks the first part of every unit for shell keywords, like as function or if statements, with no backslashes or quotes. Whenever it searches a keyword, the shell processes the compound command.
3. Searches the list of aliases.
4. Expands any tilde (~) expressions.
5. Substitutes variables.
6. Substitutes commands.
7. Substitutes arithmetic expressions.
8. Splits the items that result from command, arithmetic substitution, parameter, and again splits them into words
9. Expands wildcards.
10. Looks up built-in commands, executable files and functions.
11. Sets up I/O redirection.
12. Runs the command.
Note : The Bourne shell interprets commands same, but does not check for tildes, aliases, or arithmetic. The C shell interprets commands in a different order.