Exit Status

When a command or shell function terminates, it returns an exit status to the invoking shell. The exit status is a numeric value that indicates whether the program ran successfully and whether certain events occurred in the command.

Every command that runs has an exit status, which is set by the programmer when writing the command. Usually, an exit status of 0 means that the program executed successfully. Any non-zero value (usually 1 or -1) means that the program failed. Programmers may not always follow this convention. Check the manual page for a given command to determine its exit status. For example, the grep command returns one of three exit status values: 0 means that the search pattern was found, 1 means that the pattern could ...

Get Solaris™ 8 Advanced System Administrator's Guide, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.