Sitemap
Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development

Linux — Shell Scripting/Conditional Statements

5 min readJul 10, 2024

--

Press enter or click to view image in full size

The purpose of this hands-on training is to teach you how to use conditional statements in the shell.

Learning Outcomes

At the end of this hands-on training, you will be able to;

  • explain conditional statements in the shell.
  • use if statements in shell scripting
  • use case statements in shell scripting

Outline

  • Part 1 — If Statements
  • Part 2 — If Else Statements
  • Part 3 — If Elif Else Statements
  • Part 4 — Nested If Statements
  • Part 5 — Boolean Operations
  • Part 6- Case Statements

Part 1 — If Statements

  • Unix Shell supports conditional statements that are used to perform different actions on the basis of different conditions.
  • A simple if statement essentially states, if a particular test is true, then perform a specified set of actions. If it’s not true, don’t take those acts.
  • Create a folder and name it conditional-statements.
mkdir conditional-statements && cd conditional-statements
  • Create a script file named…

--

--

Dev Genius
Dev Genius

Published in Dev Genius

Coding, Tutorials, News, UX, UI and much more related to development