The bash shell provides a superb functionality when it comes to writing scripts. This includes many ways to loop through a pile of data so that you can get a lot done with one running of a script. Whether you’re looping through a large group of numeric values, days of the week, usernames, words, files, or something else entirely, bash has an option that can make it easy for you.
for, while, and until loops
The first thing you need to know about looping in bash is that there are several basic commands to use. The while loop will loop as long as some particular condition holds true. The until loop will loop until some condition becomes true, and the for loop will run through a series of values regardless of their origin.
Source:: Network World – Data Center