Last Updated: September 09, 2019
·
520
· bsimpson

Quick way to loop in Bash terminal

for i in `seq 10`; do <your task>; done

Actually the variable i isn't important here. All we want to do is iterate 10 times using seq 10 (This command will print a new integer on each line - perfect for looping over)

Using the semicolons, we can one line this otherwise multiline operation.

Replace <your task> with that you want to do during each loop.