Here is one shell script I used recently. Now I am not the most fluent in scripting languages so this is probably not the only way to do this but it may help someone else who is trying to do something similar in a shell script.
This was used for gzip'ing many .dmp files that were in a folder to save space. it compresses the files about 1/8th of the originaly size.
for i in *.dmp; do gzip $i; done
I ran this on one of our servers to save a large amount of disk space. I then moved all of the gzip files off to archive.
In my example I used the gzip command but you can put anything in its place.
Hope this helps someone
Labels: command line, linux, scripts