What does exit 99 means?

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.

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:

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

Tags:

Shell

Exit