Bash (Unix shell): Difference between revisions

Content deleted Content added
m tidy gnu ref
Tokenization: Shorten lists of operators
Line 497:
}}</ref>
 
=== TokenizationTokens <span class="anchor" id="Syntax"></span><span class="anchor" id="Tokens"></span><span class="anchor" id="Metacharacters"></span><span class="anchor" id="Operators"></span><span class="anchor" id="Words"></span><span class="anchor" id="Names"></span> ===
 
: <syntaxhighlight lang = text>
Line 511:
 
When Bash reads a full commandline, the complete string is broken down according to a certain set of rules into individual units called ''tokens.''
''Tokens'' are identified using, and separated from each other using ''metacharacters.'' (As of version 5.3:)
 
* The ten ''"metacharacters:"''
 
: {{Pre |‘space’ ‘tab’ ‘newline’ ‘|’ ‘&’ ‘;’ ‘(’ ‘)’ ‘<’ ‘>’}}
Line 522:
From there it further breaks ''words'' down into more specific, meaningful pieces like command names, variable assignment statements, etc.
 
* The two ''Blanks"blanks"''
 
: {{Pre |‘space’ ‘tab’}}
Line 528:
* ''Operators''
 
:* Eight of the twelve ''"control operators:"''
:* ''Control Operators''
 
:: <syntaxhighlight lang = text>
‘newline’ ‘||’ ‘&&’ ‘&’ ‘;’ ‘;;’ ‘;&’ ‘;;&|’ ‘||’ ‘|&&’ ‘(’ ‘)’ ...
</syntaxhighlight>
 
:* Five of the fourteen ''"redirection operators:"''
:* ''Redirection Operators''
 
:: <syntaxhighlight lang = text>
‘<’ ‘<>’ ‘>’ ‘>|’ ‘&>>’ ‘&>’ ‘>&’ ‘<&<’ ‘<<’ ‘<<-‘<<<’...
</syntaxhighlight>
 
Line 553:
* ''Words''
 
:* Sixteen of the twenty-two ''reserved words,'' which may be characters or words:
:* ''Reserved Words''
 
:: <syntaxhighlight lang = bash>
‘!’ ‘[[’ ‘{’ ‘]]’ ‘}’ coproc case do done else elifin esac fi for functiondo done if inthen timeelif selectelse then untilfi while...
</syntaxhighlight>