Bash Case Statement

Posted by linuxize on Mar 1, 2019 11:14 PM EDT
linuxize.com; By linuxize
Mail this story
Print this story

Bash case statements are generally used to simplify complex conditionals when you have multiple different choices. Using the case statement instead of nested if statements will help you make your bash scripts more readable and easier to maintain.

The Bash case statement has a similar concept with the Javascript or C switch statement. The main difference is that unlike the C switch statement the Bash case statement doesn’t continue to search for a pattern match once it has found one and executed statements associated with that pattern.

In this tutorial, we will cover the basics of the Bash case statements and show you how to use them in your shell scripts.

Full Story

  Nav
» Read more about: Groups: GNU, Linux

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.