Explain the steps that a shell follows while processing a command?

After the command line is terminated by the key, the shel goes ahead  with processing the command line in one or more passes. The sequence is well defined and assumes the following order.Parsing: The shell first breaks up the command line into words, using spaces and the delimiters, unless quoted. All consecutive occurrences of a space or tab are replaced here with a single space.Variable evaluation:  All words preceded by a $ are avaluated as variables, unless quoted or escaped.Command substitution:  Any command surrounded by backquotes is executed by the shell which then replaces the standard output of the command into the command line.Wild-card interpretation: The shell finally scans the command line for wild-cards (the characters *, ?, [, ]). Any word containing a wild-card is replaced by a sorted list of filenames that match the pattern. The list of these filenames then forms the arguments to the command.PATH evaluation: It finally looks for the PATH variable to determine the sequence of directories it has to search in order to hunt for the command.

Showing Answers 1 - 1 of 1 Answers

when processing a command the searchs for the utility for the command in the directories specified in the PATH varible and it in invokes that utility. That utility will execute the command with help of kernel and the output is given to shell. And then the displays out put to the user.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions