Parsing Command Line Options with getopts - Part 1

Difficulty: Intermediate
Duration: 20 minutes and 16 seconds
Students: 360
Rating: 4.6/5

In this lesson, we'll cover a range of topics designed to help you enhance your Linux scripts. We'll start off by looking at case statements, which are used to make a decision based on the value of a given variable. We'll cover functions before moving and then move on to how to process command-line options using the shell built-in getopts.

In the second part of the lesson, we'll look at managing users including how to disable, delete, and archive users on a Linux system. We'll then do a walkthrough exercise showing you how to delete a user, which you can follow along with.

This lesson is part of the Linux Shell Scripting course. To follow along with this lesson, you can download all the necessary resources here.

Learning Objectives

  • Learn about case statements and functions to make your scripts more efficient
  • Process command line options using getopts
  • Manage users in Linux

Intended Audience

  • Anyone who wants to learn Linux shell scripting 
  • Linux system administrators, developers, or programmers

Prerequisites

To get the most out of this lesson, you should have a basic understanding of the Linux command line.

Covered Topics