• This $? refers to echo/printf, not a previous command. Assign to variable to avoid it being overwritten.
  • Problematic code:
  • Correct code:
  • Rationale:
  • Exceptions:
  • Related resources: