Using Exit Statuses and Return Codes in Your Scripts

Intermediate
8m 52s
1,139
4.8/5

In this Lesson, you will learn how to determine the exit status of a given command. You'll learn how to make decisions in your scripts based on the exit statuses of various commands. Finally, you'll learn how to use exit statuses in your own scripts. We'll take a look at a demonstration that will give you a practical understanding of using exit statuses.

Learning Objectives

  • Determine the exit status of a given command.
  • Make decisions in your scripts based on exit statuses of commands.
  • Use exit statuses in your own scripts.

Intended Audience

This Lesson is intended for anyone looking to learn more about bash scripting and shell programming.

Prerequisites

To get the most out of this Lesson, you should have some basic knowledge of the command line, but it's not essential.

About the Author
Avatar
Jason Cannon, opens in a new tab
Founder, Linux Training Academy
Students
25,151
Courses
61
Learning paths
19

Jason is the founder of the Linux Training Academy as well as the author of "Linux for Beginners" and "Command Line Kung Fu." He has over 20 years of professional Linux experience, having worked for industry leaders such as Hewlett-Packard, Xerox, UPS, FireEye, and Amazon.com. Nothing gives him more satisfaction than knowing he has helped thousands of IT professionals level up their careers through his many books and courses.

Covered Topics