[GoLUG] Piping, redirection and shellscipts: 3/5/2025 7pm Eastern Standard time
Ron
admin at bclug.ca
Tue Mar 4 02:55:07 EST 2025
Steve Litt wrote on 2025-03-02 14:58:
> I've taken piping, redirection and shellscripts for granted the last
> two decades.
Dave from YSAP.sh and of YouTube bash video fame has a timely 2 minute
video out:
> Get status of an entire Bash Pipeline with `PIPESTATUS` You Suck at
> Programming #048
>
> https://www.youtube.com/watch?v=5wGgHViyokE
I've never heard of PIPESTATUS, just set -o pipefail, so again, in under
2½ minutes, Dave has something new to learn.
Someone may want to mention these during the meeting.
Example - check if any process in a series of pipe lines failed:
# true | false | true | false | true
# echo $?
0
# true | false | true | false | true
# echo "${PIPESTATUS[*]}"
0 1 0 1 0
The 1s correspond to the falses, allowing for testing of the entire
chain of results.
More information about the GoLUG
mailing list