# Repeating

Repeating: For Every File: for Loops, Line by Line: while read, Stopping Early: break, continue and Counters.

Updated: November 10, 2026

1. [For Every File: for Loops](https://www.ask-codey.com/lessons/bash-for-loops) (Apprentice): A for loop runs the same commands once for every word, number or file in a list, so renaming 12 files or 200 takes one line, with ${f%.tmp} cutting the old ending off each name.
2. [Line by Line: while read](https://www.ask-codey.com/lessons/bash-while-read) (Journeyman): while IFS= read -r line reads a file one whole line at a time, spaces and backslashes kept, and while and until repeat commands for as long as a condition is true, or until it becomes true.
3. [Stopping Early: break, continue and Counters](https://www.ask-codey.com/lessons/bash-loop-control) (Apprentice): A counter or running total is a variable a loop adds to each time round with $(( )); continue skips the rest of one pass and goes on with the next item, and break leaves the loop early.

Source: https://www.ask-codey.com/courses/bash-in-depth/topics/bash-repeating
