shopt-option
Bash lastpipe
With job control inactive, runs final foreground pipeline component in current shell. Bash-specific; avoid relying on implicit option state.
Formal Syntax & Structure
bash syntaxbash
shopt -s lastpipeReturn Value
exit status
With job control inactive, runs final foreground pipeline component in current shell. Bash-specific; avoid relying on implicit option state.
Working Example
Example Snippetbash
set +mshopt -s lastpipecount=0printf '%s\n' a b c | while IFS= read -r line; do count=$(( count + 1 ))doneprintf 'count=%s\n' "$count"