Suppose you have a line

mysqldump | gzip

in your script. Then the exit status code will be of gzip, rather than mysqldump, while the most likely process to fail here is mysqldump.

To fix this, add this at the top of your bash scripts:

set -o pipefail

Share on: TwitterHacker NewsFacebookLinkedInRedditEmail

Comments

comments powered by Disqus

Published

Category

Programming

Tags

Connect with me on...