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
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
There is no significance to exiting with code 99, other than there is perhaps in the context of a specific program.
exit exits the shell with a certain exit code, in this case, 99. You can find more information in
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.
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.
Normally, if you finish your script at some point with:
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.
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:
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'