sh: Refactor job status printing, preparing for -o pipefail and similar
No functional change is intended.