Every command exits with a status code. Bash stores the most recent status in $?, where zero means success.

Program

Play the script to see a missing file test set a nonzero status.

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

path="/tmp/report.txt"
[[ -f "$path" ]]
status=$?
echo "status=$status"
exit status A command reports success or failure with a small integer status code.
test command `[[ ... ]]` evaluates a condition and sets an exit status.