Thursday, 15 August 2013

bash - Is there a way to catch a failure in piped commands? -



bash - Is there a way to catch a failure in piped commands? -

this question has reply here:

catching error codes in shell pipe 3 answers

here's illustration of i'm trying achieve:

#!/bin/bash set -e # abort if error ... command1 2>&1 | command2 ...

and notice command1 fails command2 not , shell script happily continues... if did not have utilize pipe here, set -e have been sufficient not work pipe there...

any thoughts? thanks

since using bash, other set -e can add together set -o pipefail results want...

bash shell pipe

No comments:

Post a Comment