Check the Exit Code of the Last Command

  • echo prints text to the terminal.
  • $ is used to access the value of a variable.
  • ? is a special variable that holds the exit code of the last command.
bash
echo $?