Skip to main content
edited tags
Link
Jeff Schaller
  • 68.8k
  • 35
  • 122
  • 267
Source Link

What is Linux exit status and list of all status

I'm trying to learn Linux bash scripting and I'm read through the articles in the http://tldp.org sites I saw some kind log clearing scripting I notice that something is used for as an exit status. I have given below a few script snippet from the article.

#!/bin/bash
# Cleanup, version 3

#  Warning:
#  -------
#  This script uses quite a number of features that will be explained
#+ later on.
#  By the time you've finished the first half of the book,
#+ there should be nothing mysterious about it.

LOG_DIR=/var/log
ROOT_UID=0     # Only users with $UID 0 have root privileges.
LINES=50       # Default number of lines saved.
E_XCD=86       # Can't change directory?
E_NOTROOT=87   # Non-root exit error.

What do the E_NOTROOT(86) and E_XCD(87), if both variables use the reserved exit status code for the program or not?

OR

If both variables just use the random number for this purpose.

Reference: http://tldp.org/LDP/abs/html/abs-guide.html