Views:
4,373
Votes: 7
✅ Solution
Tag :
scripts
Link:
🔍 See Original Answer on Ask Ubuntu ⧉ 🔗
URL:
https://askubuntu.com/q/1040914
Title:
Why is exit code 0 a Success and 1 a Failure
ID:
/2018/05/27/Why-is-exit-code-0-a-Success-and-1-a-Failure
Created:
May 27, 2018
Edited: May 27, 2018
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
There can be many reasons for an error and a parent process will often know what specifically went wrong with a child process. As such 0 is used for success and 1 to 255 provides flexibility for failure reason(s).
For example a child process could return:
1
File not found2
User not authorized3
File locked by another process4
Connection not active5
Configuration incomplete6
Process cancelled by user
etc, etc.