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.
cmp $1 $2
is also more efficient thandiff $1 $2
. – Lekensteyn Jul 10 '13 at 20:32diff -q $1 $2
is even more efficient. – Evan Teitelman Jul 10 '13 at 20:36