Aggregate failure codes in bash -
i've got script has multiple stages, , @ each stage it's possible fail, script can carry on running.
concretely, generate json, , check if diff correct. diff wrong, doesn't stop next stage of json being produced.
how can aggregate failure codes of diff, return 1 if diff returned > 1, , 0 otherwise, without ending failure occured?
basically, it's folding ||
on result codes, can't seem find nice way ||
string return code.
skeleton:
main_result=0 s in stage1 stage2 stage3; diff <(generate-stuff) expected-$stage result=$? # main_result=$main_result || $result done exit $main_result
logical or can done as:
main_result=$((main_result || result))
Comments
Post a Comment