Explain the steps that a shell follows while processing a command.The sequence of executing commands by shell are as follows:
Parsing: The command is broke into words, by using the spaces as delimiters unless quoted. The tabs are replaced by a single space.
Evaluation of a variable: The words with $ as preceding character will be evaluted unless quoted.
Command Substitution: The commands surrounded by backquotes will be executed by the shell. Later these will be replaced into standard output of the command into command line.
Wild card interpretation: Finally, the shell identifies all the wild cards(?,*) in the command line and replaces the wild card with sorted list of file names which maches the pattern.
PATH evaluation: Ultimately shell looks for the PATH variable for the purpose of determining the sequence of directories to search for the files or commands.
|