Thursday, November 3, 2011

Shell script - loop over files from the text file

In shell script to loop over the files from the list in the text file simply do:

#!/bin/sh

#Get the file list from the command line
filelist=$1; shift

#Loop over the files from the list
while read f
do
echo $f
#Put your commands here...
done < $filelist

No comments:

Post a Comment