You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
134 lines
2.0 KiB
134 lines
2.0 KiB
===============================
|
|
Command
|
|
===============================
|
|
|
|
whoami
|
|
|
|
---
|
|
|
|
(source_file
|
|
(command (command_name (identifier))))
|
|
|
|
===============================
|
|
Command without trailing new line
|
|
===============================
|
|
|
|
echo hello
|
|
---
|
|
|
|
(source_file (command (command_name (identifier)) (word)))
|
|
|
|
===============================
|
|
Variable expansion
|
|
===============================
|
|
|
|
cat $FOO
|
|
|
|
---
|
|
|
|
(source_file
|
|
(command
|
|
(command_name (identifier))
|
|
(expansion (variable (identifier)))))
|
|
|
|
===============================
|
|
Redirection
|
|
===============================
|
|
|
|
cat file 2> /dev/null
|
|
echo message >&2
|
|
python <<< 'print("hello")'
|
|
|
|
---
|
|
|
|
(source_file
|
|
(command
|
|
(command_name
|
|
(identifier))
|
|
(word)
|
|
(word)
|
|
(redirection
|
|
(word)))
|
|
(command
|
|
(command_name
|
|
(identifier))
|
|
(word)
|
|
(redirection
|
|
(word)))
|
|
(command
|
|
(command_name
|
|
(identifier))
|
|
(redirection
|
|
(raw_string))))
|
|
|
|
===============================
|
|
Pipeline
|
|
===============================
|
|
|
|
cat path/to/file.txt | wc -l
|
|
|
|
---
|
|
|
|
(source_file
|
|
(pipeline
|
|
(command
|
|
(command_name
|
|
(identifier))
|
|
(word))
|
|
(command
|
|
(command_name
|
|
(identifier))
|
|
(word))))
|
|
|
|
===============================
|
|
String interpolation
|
|
===============================
|
|
|
|
echo "The result is $result"
|
|
|
|
---
|
|
|
|
(source_file
|
|
(command
|
|
(command_name
|
|
(identifier))
|
|
(template_string
|
|
(expansion
|
|
(variable
|
|
(identifier))))))
|
|
|
|
===============================
|
|
Negated command
|
|
===============================
|
|
|
|
! grep foo
|
|
|
|
---
|
|
|
|
(source_file
|
|
(command
|
|
(command_name
|
|
(identifier))
|
|
(word)))
|
|
|
|
===============================
|
|
Mix functions and commands
|
|
===============================
|
|
|
|
generate() | cut -d ' ' -f 1
|
|
|
|
---
|
|
|
|
(source_file
|
|
(pipeline
|
|
(call_expression
|
|
(identifier)
|
|
(argument_list))
|
|
(command
|
|
(command_name
|
|
(identifier))
|
|
(word)
|
|
(raw_string)
|
|
(word)
|
|
(word))))
|