A common reason people want to learn the Unix shell is to unlock the power of batch processing. If you want to perform some set of actions on many files, one of the ways to do that is by constructing a command that iterates over those files. In programming terminology, this is called execution control, and one of the most common examples of it is the for loop.

for loop is a recipe detailing what actions you want your computer to take for each data object (such as a file) you specify.

The classic for loop

An easy loop to try is one that analyzes a collection of files. This probably isn’t a useful loop on its own, but it’s a safe way to prove to yourself that you have the ability to handle each file in a directory individually.

Read more…

Related Post

Leave us a reply

You must be logged in to post a comment.