Devnull method development leads to
{ c3=0; command3 || c3=$? && false; } && command4 || command5 echo $c3
. Since each command can be replaced by
{ c=0; command || c=$? && false; }
(assuming c initially disabled if conditionally executed), it is easily extensible.
source share