The script must later test the command's exit status to decide whether to deploy the new file, notify the administrator, or log an error. In what order will the three distinct exit-status values be returned by diff when the files are (1) identical, (2) different, and (3) when an error such as an unreadable file occurs?
0, 1, 2
0, 1 (any difference or error); no separate error code
The diff utility follows a fixed convention for its exit codes. It returns 0 when no differences are found, 1 when at least one difference is detected, and 2 for any operational problem such as a missing or unreadable file. These codes allow scripts to branch cleanly on identical, changed, or error conditions. The other options either swap the meanings of 1 and 2 or claim that only two exit codes are produced, which is inaccurate.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What does the exit status of a command in Linux represent?
Open an interactive chat with Bash
How does the 'diff' command detect and compare file differences?
Open an interactive chat with Bash
What is '>/dev/null' used for in scripts?
Open an interactive chat with Bash
CompTIA Linux+ XK0-006 (V8)
Services and User Management
Your Score:
Report Issue
Bash, the Crucial Exams Chat Bot
AI Bot
Loading...
Loading...
Loading...
IT & Cybersecurity Package Join Premium for Full Access