nerdexam
Exams010-160Questions#93
LPI

010-160 · Question #93

010-160 Question #93: Real Exam Question with Answer & Explanation

The correct answer is B: 0. Unix/Linux processes return an exit code of 0 to indicate successful execution; any non-zero value signals an error or abnormal termination.

The Power of the Command Line

Question

What is the return value of a shell script after successful execution?

Options

  • A1
  • B0
  • C-1
  • D-255
  • E255

Explanation

Unix/Linux processes return an exit code of 0 to indicate successful execution; any non-zero value signals an error or abnormal termination.

Common mistakes.

  • A. Exit code 1 typically indicates a general or unspecified error, not successful execution.
  • C. Exit codes must be in the range 0-255; negative values like -1 are not valid POSIX exit codes.
  • D. Negative values such as -255 are outside the valid POSIX exit code range of 0 to 255.
  • E. Exit code 255 is used to indicate specific error conditions such as command not found, not successful completion.

Concept tested. Shell script exit codes and POSIX convention

Reference. https://www.gnu.org/software/bash/manual/bash.html#Exit-Status

Topics

#exit code#shell scripting#return value#bash

Community Discussion

No community discussion yet for this question.

Full 010-160 Practice