[NTLUG:Discuss] Catching exit code in a pipe?
David Stanaway
david at stanaway.net
Thu Apr 22 22:11:55 CDT 2010
I have a backup script that includes:
su -c "pg_dumpall | gzip -9 > backup/db.out.gz" -l postgres
$? gets the most recent pipelined command exit, and catches the gzip
exit code which is always 0.
I don't want to create an intermediate file uncompressed.
Does anyone have an idea how I can do this in bash without getting too
creative with subshells and signal handlers?
More information about the Discuss
mailing list