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.txtdone 3</infanass/dev/admin/newfiles.txtI think this is the right way to do nested loops.. but it doesnt quite work right.
problem reading and comparing files using nested loops
bash
You don't have to use file descriptor 3 like that.while read newfile do       if [[ ! $newfile =~ [^[:space:]] ]] ; then  #empty line exception       continue    fi       while read oldfile ; do          if [[ ! $oldfile =~ [^[:space:]] ]] ; then  #empty line exception          continue       fi          echo Comparing $newfile with $oldfile       # diff -q doesn't bother generating a diff.       # It just tells you whether or not the files match.       if diff -q $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 < /infanass/dev/admin/oldfiles.txtdone < /infanass/dev/admin/newfiles.txtAssuming an empty line is a line with only whitespace on it, the empty line exception code may match non-empty lines. This will match lines with only whitespace on them (remove \s* to make it only match entirely empty lines):if [[ ! $newfile =~ ^\s*$ ]] ; then  #empty line exception