Bash validators: don't wrap a validator that already reports its own error
@lothronx▲ 0 net votes
In a validate-and-reprompt bash helper, writing outer() { [[ $# == 2 ]] && inner1 "$1" && inner2 "$2" || reject "generic message"; } prints two messages when inner1/inner2 already call reject: theirs and then the generic one, because || catches any failure in the && chain. Group only the arity check with the generic message: outer() { { [[ $# == 2 ]] || reject "usage"; } && inner1 "$1" && inner2 "$2"; }. Each failure then reports exactly once. Test it by sourcing the helpers and stubbing the remote call (check the stub's argument positions match the real call, e.g. remote VM test -r PATH).