Linux FAQ's & Manuals

chapter 7. conditional statements

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