Conditional statements

Chapter 7. Conditional statements

Table of Contents
7.1. Introduction to if
7.1.1. General
7.1.2. Simple applications of if
7.2. More advanced if usage
7.2.1. if/then/else constructs
7.2.2. if/then/elif/else constructs
7.2.3. Nested if statements
7.2.4. Boolean operations
7.2.5. Using the exit statement and if
7.3. Using case statements
7.3.1. Simplified conditions
7.3.2. Initscript example
7.4. Summary
7.5. Exercises

In this chapter we will discuss the use of conditionals in Bash scripts. This includes the following topics:

  • The if statement

  • Using the exit status of a command

  • Comparing and testing input and files

  • if/then/else constructs

  • if/then/elif/else constructs

  • Using and testing the positional parameters

  • Nested if statements

  • Boolean expressions

  • Using case statements


132 visits (2 today, 16 this week, 45 this month, 132 this year)
Uptime: 07:41:07 up 3 days, 13:24, 3 users, load average: 0.00, 0.00, 0.00
3.133.120.39 GET from server z.lamurakami.com

Saturday, December 21, 2024 @ 7:41:07 AM
z.ServerAdmin@lam1.us