Shell scripts use exit status values to decide whether later work should continue. Modeling the status keeps the lesson deterministic without exiting the replay.

Program

Play the script to choose a status and see the next-step decision.

exit_status_check.sh
#!/usr/bin/env bash

status=
command="validate-config"
if [ "$status" -eq 0 ]; then
    result="continue"
else
    result="stop:$status"
fi
echo "$command:$result"
#!/usr/bin/env bash

status=
command="validate-config"
if [ "$status" -eq 0 ]; then
    result="continue"
else
    result="stop:$status"
fi
echo "$command:$result"
exit status An exit status is the numeric result of a command.
zero Status zero conventionally means success.
stop path A nonzero status should usually stop or recover before continuing.