8.9 Wildcards Inside of AliasesHere's another example in which command-line parsing is important. Consider this alias for counting the number of words in all files:
Right away, we can see one effect of command-line parsing. The shell
sees the quotation marks, and knows not to expand wildcards inside the
quotation marks.
Therefore, Now, think about what happens when you execute the alias. You type: % The shell starts working through its steps (8.5 ) , and eventually performs alias substitution. When this happens, it converts your command into: wc -w * Now, watch carefully. The shell continues working through the process
of interpretation (redirection, variable substitution, command
substitution), and eventually gets to filename expansion. At this
point, the shell sees the To me, the amazing thing is that all this works - and works well! The workings of the command line are intricate and complex, but the shell almost always does what you want - and without a lot of thought. - |
|