Conditional Testing and Scripting Loops

This chapter will begin with a recap on if-then-else, before presenting advanced uses of if-then-else conditionals. We will introduce scripting loops in the form of while and for, and we will show how we can control these loops with exit, break, and continue.

The following commands will be introduced in this chapter: elif, help,  while, sleep, for, basename, break, and continue.

The following topics will be covered in this chapter:

  • Advanced if-then-else
  • The while loop
  • The for loop
  • The loop control

Get Learn Linux Shell Scripting - Fundamentals of Bash 4.4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.