I am trying to compare 2 x files. If the contents are not commons, I want to echo them.
Here is my code thus far
#!/bin/bash
while IFS= read -r line && IFS= read -r line2 <&3; do
if [ "$line" -ne "$line2" ]; then
echo "we doing this $line2"
else
echo "we will not do this $line2"
fi
done <file1test 3<file2test
The contents of each file which I am testing are just numbers. file1test is from 1..10 per line and file2test if from 1..20 per line.
My code only echos 1..10 which is common to both.
man comm.IFS= read -r line && IFS= read -r line2 <&3is only true if bothreads succeed