while read newfile <&3; do if [[ ! $newfile =~ [^[:space:]] ]] ; then #empty line exception continue fi # while read oldfile <&3; do if [[ ! $oldfile =~ [^[:space:]] ]] ; then #empty line exception continue fi echo Comparing "$newfile" with "$oldfile" # if diff "$newfile" "$oldfile" >/dev/null ; then echo The files compared are the same. No changes were made. else echo The files compared are different. fi done 3</infanass/dev/admin/oldfiles.txt done 3</infanass/dev/admin/newfiles.txt
I think this is the right way to do nested loops.. but it doesnt quite work right.