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 | command

Return 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[*]}"
Bash Reference