Shell

Sintaxes completas representadas por Diagrama Sintático - Diagrama de Sintaxe (ver convenções) ou BNF (ver convenções).
Diagrama Sintático - Diagrama de Sintaxe | Diagrama Sintático - Diagrama de Sintaxe e BNF | BNF
complete_command : list separator?
list : and_or {separator_op and_or}
and_or : pipeline {and_or ('&&' | '||') linebreak pipeline}
pipeline : '!'? pipe_sequence
pipe_sequence : command {('|' linebreak) command}
command : simple_command | compound_command redirect_list? | function_definition
compound_command : brace_group | subshell | for_clause | case_clause | if_clause | while_clause | until_clause
subshell : '(' compound_list ')'
compound_list : newline_list? term separator?
term : and_or {separator and_or}
for_clause : for name linebreak [in [wordlist] sequential_sep] do_group
wordlist : wordlist: WORD+
case_clause : case WORD linebreak in linebreak (case_list|case_list_ns|'') esac
case_list_ns : case_list? case_item_ns
case_list : case_item+
case_item_ns : '('? pattern ')'compound_list? linebreak
case_item : '('? pattern ')' (linebreak|compound_list) ';;' linebreak
pattern : WORD { '|' WORD }
if_clause : if compound_list then compound_list [{elif compound_list then} else compound_list] fi
while_clause : while compound_list do_group;
until_clause : until_clause: until compound_list do_group;
function_definition : fname '()' linebreak function_body
function_body : compound_command redirect_list?
fname : NAME
brace_group : '{' compound_list '}'
do_group : do compound_list done
simple_command : cmd_prefix? cmd_name cmd_suffix?
cmd_name : WORD
cmd_prefix : cmd_prefix: (io_redirect | ASSIGNMENT_WORD)+
cmd_suffix : ( io_redirect | WORD)+
redirect_list : io_redirect+
io_redirect : IO_NUMBER?( io_file | io_here)
io_file : ('<' | '<&' | '>' | '>&' | '>>' | '<>' | '>|') filename
filename : WORD
io_here : ('<<' | '<<-') here_end
here_end : WORD
newline_list : newline_list? NEWLINE
linebreak : newline_list | ''
separator_op : '&' | ';'
separator : separator_op linebreak | newline_list
sequential_sep : ';' linebreak | newline_list