I was looking through the bash
man page after reading through some of @Tim's questions about shell grammar, and I came up with a (simple) question of my own.
Here is an excerpt from man bash
(see it yourself at LESS=+/^DEFINITIONS man bash
:
word A sequence of characters considered as a single unit by the
shell. Also known as a token.
...
metacharacter
A character that, when unquoted, separates words. One of the
following:
| & ; ( ) < > space tab
control operator
A token that performs a control function. It is one of the fol-
lowing symbols:
|| & && ; ;; ( ) | <newline>
But here's the circle I'm not getting:
;
is a "metacharacter."- A "metacharacter", when unquoted, separates "words."
- "Token" is another term we can use for "word."
;;
is a token.- Therefore
;;
is a word.
But, that means it's a word consisting of two word separators. Given that it's unquoted and doesn't require blanks around it to be recognized (or does it??), how is this possible?
If your curious, the other questions about shell grammar I was reading through are these:
;;
as a single token (SEMI_SEMI) has a higher precedence over interpreting it as two. If you're really curious about how it's done, it's all in http://www.opensource.apple.com/source/bash/bash-44.5/bash/parse.y . My mildly damaged brain doesn't find it to be a pleasant read. – Petr Skocik Mar 18 '16 at 22:06