Bash Shell Scripting- Exit Status of a Command

Bash Shell Scripting- Exit Status of a Command

Assessment

Interactive Video

Information Technology (IT), Architecture

University

Hard

Created by

Quizizz Content

FREE Resource

The video tutorial explains the concept of exit status in Linux commands, which indicates whether a command was executed successfully or failed. A status of zero means success, while a non-zero status indicates an error. The tutorial demonstrates how to check the exit status using the $? variable and how to store it in a custom variable. It provides practical examples, such as searching for a file and understanding common exit codes like 127 for command not found and 1 for execution errors.

Read more

7 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does an exit status of zero indicate in Linux commands?

The command usage was incorrect.

The command was executed successfully.

The command was not found.

The command was executed with errors.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you check the exit status of the last executed command in Linux?

By using the command '$?'.

By using the command 'status check'.

By using the command 'status $?'.

By using the command 'exit status'.

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does a non-zero exit status indicate?

The command was executed twice.

The command was not executed.

The command was executed with an error.

The command was executed successfully.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How can you store the exit status of a command into a variable?

By using 'var = $?'.

By using 'exit $?'.

By using 'status = $?'.

By using 'code = $?'.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does an exit status of '127' signify?

Command executed successfully.

Command not found.

Command executed with warnings.

Command usage was incorrect.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

If a command returns an exit status of '1', what does it mean?

The command was not found.

The command executed successfully.

The command was valid but failed during execution.

The command usage was incorrect.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does an exit status of '2' indicate?

Incorrect command usage.

Command executed successfully.

Command not found.

Command executed with warnings.