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


144 visits (3 today, 12 this week, 57 this month, 144 this year)
Uptime: 20:19:46 up 10 days, 2:03, 7 users, load average: 0.00, 0.00, 0.15
3.139.69.138 GET from server z.larryforalaska.com

Friday, December 27, 2024 @ 8:19:46 PM
z.ServerAdmin@lam1.us