Hi all,
I am using an if condition to compare the word count of a file to be equal to 21.If the file is equal(having 21 words),it is working correct.The problem is that if the file is having different word count than 21 also it is going inside the if loop.I tried using = also instead of -eq.Still no go.Any inputs on this?
Thanks,
Floyd
wordcount=`head -1 $dir/$file1 | wc -w`
echo "WC is $wordcount"
dbwordcount=21
if [ wordcount -eq dbwordcount ]; then
echo "Word are matching $wordcount $dbwordcount"
else
echo "Words not matching $wordcount"
fi