Concept Flow - Exit codes ($?)
Run Command
Command Finishes
Shell Stores Exit Code in $?
Check $? for Success (0) or Failure (non-0)
Use Exit Code to Decide Next Steps
When a command runs, the shell saves its exit code in $? which tells if it succeeded (0) or failed (non-zero). You can check $? to decide what to do next.