Case statements can offer an easy-to-read alternative to traditional conditional statements that utilize if
/elif
/else
. Similar to conditional statements, case statements allow you to determine flow within your shell scripts. One common use case is comparing the same variable against potential values that perform specific actions.
In this lab, you will utilize case statements in a Linux shell script. The commands used in this lab have been covered in the Case Statements in Shell Scripts course. References to the specific lessons of the course will be provided throughout the lab steps.
The expected outputs for each lab step are provided as comments in the lab script file.
Upon completion of this lab, you will be able to:
You should be familiar with the following Linux scripting features before attempting this lab:
Refer to the following courses to fulfill the prerequisite: