- An exit status is the number a command reports its result with: 0 is success, anything else a failure.
$?holds it until the next command. if,&&and||look at a command's status directly, and a script hands over its own status withexit— timers and monitoring read it.- curl succeeds on any answer it receives:
-fturns an answer with status 400 or above into a failure, and--max-timecuts off a hang. set -euo pipefailstops a script on an unchecked failure, a typo in a variable and a failure inside a pipeline.- healthcheck.sh from the start of the lesson printed OK because the condition checked the status of the
echothat stood between curl andif.
Step 8 of 8 · summary · 2 min
Summary
Found an inaccuracy? Report an error in the lesson