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.
Written by Ben Simpson
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#