Exit Status

All Unix programs exit with an exit status which generally denotes success or failure of the program. This is useful, for example, with the `&&' and `||' constructs in the Unix Shell Metacharacters section following. See also Shell Scripts (section 3.9, page [*]).

The exit status is a numeric value: 0 denoting success and any positive integer denoting failure. Although somewhat counter-intuitive, the simple rationale for this is that there is usually only one way of succeeding, but a number of ways of failing.

You can visually check the exit status of a program by typing `echo $?' or `echo $status' (depending on your shell) immediately after running the program.



Loc Van Huynh 2007-03-15
Please complete our new website survey