Note: This site is currently "Under construction". I'm migrating to a new version of my site building software. Lots of things are in a state of disrepair as a result (for example, footnote links aren't working). It's all part of the process of building in public. Most things should still be readable though.

Create A For Loop In bash

Multiline

Code

for i in {0..11}
do 
  echo "This is ${i}"
done

Single Line

Code

for i in {0..11}; do echo "This is ${i}"; done

Another example:

Code

for i in {1..14}; do ffmpeg -i "1-15sec.mp4" -to ${i} "1-${i}.mp4"; done