command-syntax
Bash pipeline
Connect stdout of the left command to stdin of the right command; aggregate status normally comes from the last stage.
Formal Syntax & Structure
bash syntaxbash
command | commandReturn Value
exit status
Connect stdout of the left command to stdin of the right command; aggregate status normally comes from the last stage.
Working Example
Example Snippetbash
printf 'apple\nbanana\n' | grep -F banana | tr 'a-z' 'A-Z'saved=( "$?" "${PIPESTATUS[@]}" )printf 'statuses: %s\n' "${saved[*]}"