=============================== Commands =============================== whoami --- (program (command (command_name (word)))) =============================== Commands with arguments =============================== cat file1.txt git diff --word-diff=color -- file1.txt file2.txt echo $sing\ levar --- (program (command (command_name (word)) (word)) (command (command_name (word)) (word) (word) (word) (word) (word)) (command (command_name (word)) (simple_expansion (variable_name)) (word))) =============================== Quoted command names =============================== "$a/$b" c --- (program (command (command_name (string (simple_expansion (variable_name)) (string_content) (simple_expansion (variable_name)))) (word))) =============================== Commands with numeric arguments =============================== exit 1 --- (program (command (command_name (word)) (number))) =================================== Commands with environment variables =================================== VAR1=1 ./script/test VAR1=a VAR2="ok" git diff --word-diff=color --- (program (command (variable_assignment (variable_name) (number)) (command_name (word))) (command (variable_assignment (variable_name) (word)) (variable_assignment (variable_name) (string (string_content))) (command_name (word)) (word) (word))) =================================== Empty environment variables =================================== VAR1= VAR2= echo --- (program (variable_assignment (variable_name)) (command (variable_assignment (variable_name)) (command_name (word)))) =============================== File redirects =============================== whoami > /dev/null cat a b > /dev/null 2>&1 whoami echo "foobar" >&2 [ ! command -v go &>/dev/null ] && return if [ ]; then >aa >bb fi exec {VIRTWL[0]} {VIRTWL[1]} <&- >&- exec {VIRTWL[0]}<&- {VIRTWL[1]}>&- grep 2>/dev/null -q "^/usr/bin/scponly$" /etc/shells --- (program (redirected_statement (command (command_name (word))) (file_redirect (word))) (redirected_statement (command (command_name (word)) (word) (word)) (file_redirect (word))) (command (file_redirect (file_descriptor) (number)) (command_name (word))) (redirected_statement (command (command_name (word)) (string (string_content))) (file_redirect (number))) (list (test_command (redirected_statement (negated_command (command (command_name (word)) (word) (word))) (file_redirect (word)))) (command (command_name (word)))) (if_statement (test_command) (redirected_statement (file_redirect (word)) (file_redirect (word)))) (redirected_statement (command (command_name (word)) (concatenation (word) (word) (word) (number) (word) (word)) (concatenation (word) (word) (word) (number) (word) (word))) (file_redirect) (file_redirect)) (redirected_statement (command (command_name (word)) (concatenation (word) (word) (word) (number) (word) (word))) (file_redirect (concatenation (word) (word) (word) (number) (word) (word))) (file_redirect)) (redirected_statement (command (command_name (word))) (file_redirect (file_descriptor) (word) (word) (string (string_content)) (word)))) =============================== File redirects (noclobber override) =============================== whoami >| /dev/null cat a b >| /dev/null --- (program (redirected_statement (command (command_name (word))) (file_redirect (word))) (redirected_statement (command (command_name (word)) (word) (word)) (file_redirect (word)))) =============================== Heredoc redirects =============================== node < $tmpfile a $B ${C} EOF wc -l $tmpfile --- (program (redirected_statement (command (command_name (word))) (heredoc_redirect (heredoc_start) (file_redirect (simple_expansion (variable_name))) (heredoc_body (simple_expansion (variable_name)) (heredoc_content) (expansion (variable_name)) (heredoc_content)) (heredoc_end))) (command (command_name (word)) (word) (simple_expansion (variable_name)))) ================================= Heredocs with many file redirects ================================= FOO=bar echo < err.txt > hello.txt hello EOF --- (program (redirected_statement body: (command (variable_assignment name: (variable_name) value: (word)) name: (command_name (word))) redirect: (heredoc_redirect (heredoc_start) redirect: (file_redirect descriptor: (file_descriptor) destination: (word)) redirect: (file_redirect destination: (word)) (heredoc_body) (heredoc_end)))) ================================= Heredocs with pipes ================================= one < temp EOF --- (program (redirected_statement body: (command name: (command_name (word))) redirect: (heredoc_redirect (heredoc_start) (heredoc_body) (heredoc_end))) (redirected_statement body: (command name: (command_name (word))) redirect: (heredoc_redirect (heredoc_start) (heredoc_body) (heredoc_end))) (function_definition name: (word) body: (compound_statement (redirected_statement body: (command name: (command_name (word))) redirect: (heredoc_redirect (heredoc_start) (heredoc_body) (heredoc_end))))) (redirected_statement body: (command name: (command_name (word))) redirect: (heredoc_redirect (heredoc_start) redirect: (file_redirect destination: (word)) (heredoc_body) (heredoc_end)))) ========================================== Heredocs with weird characters ========================================== node <<_DELIMITER_WITH_UNDERSCORES_ Hello. _DELIMITER_WITH_UNDERSCORES_ node <<'```' Hello. ``` node < /dev/null; <<