Loops
Core Idea
Loops repeat commands for lists or while a condition stays true.
Practice Alone
Use for for known lists and while for condition-driven repetition.
Done When
You can replace five repeated command lines with one loop.
Go Deeper
- One-liners shows compact
forloops at the prompt. - Use a script file when the loop becomes hard to read.

Linux Foundations