(Show all Scripting articles . . .
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

Scripting: Looping in Bash


Looping constructs for bash scripts...
The for loop is used to iterate through an action until done. Let's say you have a directory full of images that you want to convert from one format to another. You could use a for loop and ImageMagick's convert (or another program) to convert JPEG images into PNG format, for instance. Or create a script to take a directory full of MP3s or WAV files and convert to Ogg Vorbis.

The while loop is used to perform an action while a condition is true, and until does the opposite it performs an action until a condition is true. So you might run a counter, for example, up to 10 and perform an action until the counter hits 10. We'll look at this more closely in the examples.
 read more | mail this link | score:7908 | -Ray, October 27, 2010
More Programming articles...

Gallery Wrapped Abstract Art

coding headlines

OpenShift Online: a non-developer guide

Introduction to Perl one-liners

Using Git for Source Control

Add Video Streaming to C/C++ apps with Nex Gen Media Server API

e-book: Sed One-Liners Explained

Apache2, mod_rewrite tutorial: Redirect requests by device


Firefox sidebar

Site map

Site info

News feed


(to post)


Articles are owned by their authors.   © 2000-2012 Ray Yeargin