Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
Most programs in FreeBSD return an exit status when they terminate. The exit status is usually 0 if successful, and some number other than 0 if something went wrong. Some programs will return a different exit status, depending on the problem. Often, this information can be found in the program's man page.
The exit status of the last program that ran is stored in the magic variable “$?”. Here are a couple of examples: