#!/usr/bin/env bash
failed=() # array of names
run_job() {
local name="$1"
shift
"$@"
rc=$?
if (( rc != 0 )); then
failed+=("$name")
fi
}
# examples
run_job job1 false
run_job job2 true
run_job job3 ls /does/not/exist
# print results
if (( ${#failed[@]} > 0 )); then
echo "Failed jobs:"
for n in "${failed[@]}"; do
echo " $n"
done
else
echo "All jobs succeeded"
fi
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)