Linux › Section K · Shell scripts › Topic K.4
Loops and command substitution
Loops let a script do the same job for every file, argument or line, and command substitution lets it capture a command's output and use it as data. Together they turn a one-off command into something that handles a whole directory.
In this topic
- Repeating work
- for loops
- When a glob matches nothing
- while and until
- Reading a file line by line
- Worked example: waiting with a limit
- Command substitution
- Quoting a substitution
- Worked example: counting lines in every text file
- Common mistakes to avoid
- Key takeaways
This topic is part of Wuanberri Pro. Checking your access…
