nerdexam
Linux_Foundation

LFCS · Question #459

You are writing a script and want to test the exit status of a process. Which of the following is true?

The correct answer is D. The normal exit value is 0. In shell scripting, a process conventionally returns an exit status of 0 to indicate successful execution.

Submitted by minji_kr· Apr 18, 2026Essential Commands

Question

You are writing a script and want to test the exit status of a process. Which of the following is true?

Options

  • AThe normal exit value differs.
  • BYou can't test the normal exit value.
  • CThe normal exit value is $EXIT.
  • DThe normal exit value is 0.

How the community answered

(67 responses)
  • A
    4% (3)
  • B
    1% (1)
  • C
    1% (1)
  • D
    93% (62)

Why each option

In shell scripting, a process conventionally returns an exit status of `0` to indicate successful execution.

AThe normal exit value differs.

The normal exit value is consistently `0` for success; it does not differ based on the process type.

BYou can't test the normal exit value.

The exit value is always testable in shell scripts using the special variable `$?` immediately after a command execution.

CThe normal exit value is $EXIT.

`$EXIT` is not a standard or recognized shell variable for storing the exit status of the last executed command; the correct variable is `$?`.

DThe normal exit value is 0.Correct

In Unix-like operating systems and shell scripting, a process conventionally returns an exit status of `0` to indicate successful execution and completion without errors. Any non-zero exit status (typically 1-255) indicates some form of error or abnormal termination.

Concept tested: Shell script exit status conventions

Source: https://www.gnu.org/savannah-checkouts/gnu/bash/manual/bash.html#Exit-Status

Topics

#Exit Status#Shell Scripting#Process Management#Bash

Community Discussion

No community discussion yet for this question.

Full LFCS Practice