Looping through files and strings
<<<< ^^^^^ >>>>

loopfiles.sh
#!/bin/bash
shopt -s nullglob ## Prevent trigger on no files
for i in *; do
echo $i
done
 
loopstring.sh
#!/bin/bash
celebrities="Stallman Torvalds Wall"
for i in $celebrities; do
echo $i
done



showfiles.sh
#!/bin/bash
shopt -s nullglob ## Prevent trigger on no files
directory=$1
for filename in $directory/*; do
if test -d $filename; then
./showfiles.sh $filename
elif test -f $filename; then
echo $filename
fi
done



<<<< ^^^^^ >>>>

 
 
 
 
Copyright (C) 2005 by Steve Litt, you can freely distribute unmodified copies if this copyright notice and disclaimer are intact.  This material originally appeared on Troubleshooters.Com.

This presentation has no warranty, express or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose. The entire risk as to the quality and performance of the presentation is with you. Neither the author nor those who show the slideshow are responsible for any damage caused by errors, omissions, or anything else relating to this slideshow.
 

20.html

Exit Slideshow