Bash Scripting on Linux (The Complete Guide) Class 06 - Exit Codes
Learn Linux TV Learn Linux TV
632K subscribers
63,810 views
0

 Published On Nov 28, 2022

How do you tell whether or not a task completed successfully? Usually, an error message is a sure sign that something went wrong. But when it comes to Linux, you won't always have that to rely on. In this video, you'll learn all about exit codes, which is how you determine whether or not a task in Linux is successful or if it failed.

Support Learn Linux TV
Note: Commission may be earned for any and all links presented here.
- Get your own cloud server with Akamai Connected Cloud ➜ https://learnlinux.link/akamai
- Become a channel member here on YouTube ➜ https://learnlinux.link/join
- Become a Patron on Patreon ➜ https://learnlinux.link/patron
- Check out my latest book, Mastering Ubuntu Server 4th Edition ➜ http://ubuntuserverbook.com
- Affiliate store for Linux compatible hardware/accessories ➜ https://learnlinux.link/amazon
- Check out the Tiny Pilot KVM for your Homelab ➜ https://learnlinux.link/tinypilot

Time Codes
00:00 - Intro
00:54 - What are "Exit Codes" in Linux?
01:31 - How does Bash perceive success and failure?
02:16 - Checking the $? variable to determine a command's Exit Code
03:35 - How to interpret the value of Exit Codes in Linux
04:15 - Why it can benefit us to utilize Exit Codes in our Bash Scripts
05:22 - An example Bash Script that utilizes Exit Codes
07:48 - More efficiently utilizing Exit Codes in our Bash Scripts
14:42 - An example script that illustrates why execution order is important in Bash
20:55 - How to manipulate the exit code of a task
23:35 - Another example of task order in Bash being very important

OTHER BASH SCRIPTING SERIES EPISODES
- Class 01 ➜ Introduction: https://linux.video/bash1
- Class 02 ➜ Hello World: https://linux.video/bash2
- Class 03 ➜ Variables: https://linux.video/bash3
- Class 04 ➜ Math Functions: https://linux.video/bash4
- Class 05 ➜ If Statements: https://linux.video/bash5
- Class 06 ➜ Exit Codes: https://linux.video/bash6
- Class 07 ➜ While Loops: https://linux.video/bash7
- Class 08 ➜ Universal Update Script: https://linux.video/bash8
- Class 09 ➜ For Loops: https://linux.video/bash9
- Class 10 ➜ Where To Store Your Scripts: https://linux.video/bash10
- Class 11 ➜ Data Streams: https://linux.video/bash11
- Class 12 ➜ Functions: https://linux.video/bash12
- Class 13 ➜ Case Statements: https://linux.video/bash13
- Class 14 ➜ Scheduling Jobs (Part 1): https://linux.video/bash14
- Class 15 ➜ Scheduling Jobs (Part 2): https://linux.video/bash15
- Class 16 ➜ Arguments: https://linux.video/bash16
- Class 17 ➜ Building a Backup Script: https://linux.video/bash17
- Class 18 ➜ Closing: https://linux.video/bash18

Full Courses from Learn Linux TV
• Linux Crash Course series ➜ https://linux.video/cc
• Learn how to use tmux ➜ https://linux.video/tmux
• Learn how to use vim ➜ https://linux.video/vim
• Bash Scripting Series ➜ https://linux.video/bash
• Proxmox VE Cluster Full Course ➜ https://linux.video/pve
• Learn Ansible ➜ https://linux.video/ansible

Boost your Linux skills with these stand-alone tutorials
• Essential tweaks for ALL Linux Servers ➜ https://linux.video/all-servers
• Install Arch Linux ➜ https://linux.video/arch-guide
• Use Ventoy to create a multi-distro flash drive ➜ https://linux.video/ventoy
• Browse the web from within your Linux terminal ➜ https://linux.video/term-web
• From Zero to Proxmox ➜ https://linux.video/zero-to-pve
• Check out Neovim ➜ https://linux.video/neovim
• Systemd Deep Dive ➜ https://linux.video/systemd
• Systemd Timers ➜    • Automate Your Tasks with systemd Time...  
• Installing an operating system for Raspberry Pi ➜ https://linux.video/pi-imager
• Connecting to a Linux server via ssh ➜ https://linux.video/ssh
• Linux permissions ➜ https://linux.video/perms
• OpenSSH Guide ➜ https://linux.video/ssh-guide
• 10 Linux Terminal Tips and Tricks ➜ https://linux.video/cli-tricks-1
• Over 15 Terminal Tricks ➜ https://linux.video/cli-tricks-2

Learn Linux TV on the Web
- Main site ➜ https://www.learnlinux.tv
- Community ➜ https://community.learnlinux.tv

Learn Linux TV provides technical content that will hopefully be helpful to you and teach you something new. However, this content is provided without any warranty (expressed or implied). Learn Linux TV is not responsible for any damages that may arise from any use of this content. The person viewing Learn Linux TV's content is expected to follow their best judgement and to make their best decisions while working with any related technology. Always make sure you have written permission before working with any infrastructure. Also, be sure that you're compliant with all company rules, change control procedures, and local laws.

#linux #linuxtutorial #bash

show more

Share/Embed