So the object of the script I'm making is to compare files from two while read lists that have file path names in them...
while read compareFile <&3; do
if [[ ! $server =~ [^[:space:]] ]] ; then #empty line exception
continue
fi
echo "Comparing file - $compareFile"
if diff "$compareFile" _(other file from loop?_) >/dev/null ; then
echo Same
else
echo Different
fi
done 3</infanass/dev/admin/filestoCompare.txt
I need to be able to compare files from two different lists at the same time through two while read loops... Is this even possible?
Not really understand what you want achieve, but the next:
where the
list1.txt
contains:and the
list2.txt
contains:produces the next output:
Remove the
echo
before thediff
if you satisfied.I think I would restructure that along these lines:
That uses a single loop, and will exit that loop when end of file is reached on either input file. The logic would be a little more complicated if you want to read both files entirely, even if one ends early...
if I understand you correctly...yes. Here's an example of looping through two files in lock-step