Exam 010-160 Topic 3 Question 37 Discussion
Actual exam question for Lpi's 010-160 exam
Question #: 37
Topic #: 3
Question #: 37
Topic #: 3
What is the return value of a shell script after successful execution?
Suggested Answer: B Vote an answer
The return value of a shell script after successful execution is 0. This is a convention followed by most UNIX and Linux commands, programs, and utilities. A return value of 0 indicates that the command or script completed successfully, without any errors. A return value of non-zero (1-255) indicates that the command or script failed, and the value can be interpreted as an error code. The return value of a command or script is stored in the special variable $? and can be used to test the outcome of a command or script123. For example, the following script will print a message based on the return value of the ls command:
#!/bin/bash ls if [ $? -eq 0 ]; then echo "ls command executed successfully" else echo "ls command failed" fi
#!/bin/bash ls if [ $? -eq 0 ]; then echo "ls command executed successfully" else echo "ls command failed" fi
by Shirley at Apr 08, 2026, 12:28 PM
0
0
0
10
Comments
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Report Comment
Commenting
You can sign-up / login (it's free).