Exit Code

say it: “EG-zit KOHD” /ˈɛɡzɪt ˈkoʊd/

The number a command returns: 0 for success, other values for errors.

What is Exit Code?

Every command finishes with an exit code: 0 means success, anything else means an error. $? holds the last one.

ls missing-folder
echo $?   # 2

mkdir backups && echo "created"   # only runs if mkdir succeeded

Level: Journeyman · More Unix terms at this level

Updated

In other subjects