I have two files as atributes in my script with ten lines in each. They contain simple answers: YES or NO. I need to compare those two files and get number of good answers and bad answers. I need to have them in separate variables. I have tried :
diff <(nl $1) <(nl $2) | grep -E '<' | wc -l
and i get number of bad aswers, but i want it to be in some variable.
Either you're no good at describing what you want to achieve or the command doesn't do what you think it does.
Anyway - to store the output in a variable just do:
variable=$(diff <(nl $1) <(nl $2) | grep -E '<' | wc -l)