I want to know what is exit 99 and why would one use it and what are the significance uses of it.

For example, I'm using exit 99.


5 Answers 5


There is no significance to exiting with code 99, other than there is perhaps in the context of a specific program.

Either way, exit exits the shell with a certain exit code, in this case, 99. You can find more information in help exit:

exit: exit [n]
    Exit the shell.

    Exits the shell with a status of N.  If N is omitted, the exit status
    is that of the last command executed.
  • If you want to do something specific with a return code like that in bash, use the $? to get to it. Commented Apr 17, 2014 at 9:56
  • 6
    Not quite - 99 is not zero, and so indicates that the program failed for some reason.
    – psusi
    Commented Apr 17, 2014 at 13:35
  • 3
    @psusi There are plenty of non-zero exit codes in applications that are not to do with failure, but indicate other execution conditions (many programs use it to indicate falsiness or non-optimal execution rather than failure, for example). To assert that a certain exit status must indicate failure without knowing the program is simply not true. I won't speculate on the meaning of "99" in some unknown program.
    – Chris Down
    Commented Apr 17, 2014 at 18:24
  • 1
    The shell, and most other tools, including make, treat any non zero exit value as an error.
    – psusi
    Commented Apr 17, 2014 at 19:23
  • 2
    Except for these only indicate failure in isolation, not in larger context of checking for truthiness. Either way, I refuse to speculate on the meaning of some exit code when the application is not defined.
    – Chris Down
    Commented Apr 20, 2014 at 9:14

In addition to @Chris Down, there is some return code that reserved for the shell, they have special meaning:

RETVAL   Meaning

1        General errors
2        Misusage
127      Command not found

You can refer to this for more details.

  • @MrLister: Yeap, my mistypo, fixed!
    – cuonglm
    Commented Apr 17, 2014 at 9:33
  • there is still a s missing in there ("Misuage"?) Commented Apr 17, 2014 at 10:06

Normally, if you finish your script at some point with:

exit 0

The shell will get a 0 as the return code. This zero means everything was OK.

However, if your program has found some error condition, you should exit with a non-zero return code, to inform the shell that something has gone wrong. If you don't want to be more specific, you can simply use 1.

exit 1

You can however, inform the shell of particular type of failures by using other numbers. For example, bash itself returns a 127 for program not found. So if you document the behaviour of your script, you can do something useful after running it by checking the value of the special variable $?, which holds the return code of the last executed program.

I looked into this a while ago and found that, for example, FreeBDS had some very useful conventions with regards to exit codes, documented in man 3 sysexits


There is a very long-standing convention (in Unix) for return-status ranges:

  • 0 means success
  • positive numbers mean minor problems, but essentially the task completed
  • negative numbers mean critical error (e.g. disk-full, file-not-found)

Exactly what those individual positive and negative numbers mean is up to the programmer. Sometimes you can choose them for compatibility with other similar programs (e.g. Gnu tools). @Gnouc lists some.

No, I'm not aware of any special significance to exit code 99, never seen it used. Maybe it means 'Not enough beer'


  • 2
    I never heard of that Unix convention. And your two references do not support your assertion about that convention.
    – fpmurphy
    Commented Apr 20, 2014 at 14:06
  • The first reference does. There are 1.67m google hits on unix return status positive negative numbers.
    – smci
    Commented Apr 20, 2014 at 20:17
  • 2
    There are a small number of negative return values specified in POSIX.1 but these are for programming APIs
    – fpmurphy
    Commented Apr 25, 2014 at 0:02

Some programmers will supply a lot of different errorcodes starting with 1. New versions might introduce new specific errorcodes, so which code should be used for
"all other errors / unspecified error" ? The exit codes will be truncated at 255, so I would choose 99 as an "other error".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .