Skip to content
skillbld
Linux Command Line · 14-day planAll days
Day 12 of 14 35 min

Let the computer do repetitive work. Loop over lists, files and number ranges with for, repeat with while, read a file line by line, organise scripts into functions with arguments and return values, and build a small backup script that puts it all together.

By the end of today you can

  • Loop over words, files and number ranges with for
  • Repeat while a condition holds, and read a file line by line
  • Use break and continue to control loops
  • Write functions with arguments, local variables and return codes
  • Combine loops and functions in a practical backup script

What's inside

  • 4 sections
  • 3 diagrams and mind maps
  • 6 code examples you can run
  • 5-question quiz
  1. 1for loops
  2. 2while loops
  3. 3Functions
  4. 4Putting it together: a backup script

Sign in free to read this lesson

Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.

Sign in free

Keep going

Day 12: Loops & Functions · Linux Command Line · SkillBld