182. What are the main steps taken by a Unix Shell for processing a
command?
A Unix Shell takes following main steps to process a command:
I. Parse : First step is to parse the command or set of commands given in a Command Line Interface (CLI). In this step multiple
consecutive spaces are replaced by single space. Multiple commands that are delimited by a symbol are divided into multiple
individual actions.
II. Variable : In next step Shell identifies the variables mentioned in commands. Generally any word prefixed by $ sign is a variable.
III. Command Substitution : In this step, Shell executes the commands that are surrounded by back quotes and replaces that section
with the output from the command.
IV. Wild Card : Once these steps are done, Shell replaces the Wild card characters like asterisk * with the relevant substitution.
V. Execute : Finally, Shell executes all the commands and follows the sequence in which Commands are given in CLI.