Status

cmd_status

Test the exit status of the most recently run command against a named or numeric expectation. Functionalises the common 'if [ $? = ... ]' idiom.

Example

somecommand
if status true; then

Arguments

  • $1 (string): Expected result: y/yes/0/true for success, n/no/1/false for failure

Exit codes

  • 0: Last command's status matches the expectation
  • 1: Last command's status does not match the expectation

cmd_status_true

Return 0 if the last command succeeded (exit code 0). Alias shorthand for cmd_status().

Exit codes

  • 0: Last command succeeded
  • 1: Last command failed

cmd_status_false

Return 0 if the last command failed (exit code > 0). Alias shorthand for cmd_status().

Exit codes

  • 0: Last command failed
  • 1: Last command succeeded