I use find
to get all txt
files , then use grep
to find if a special word in the txt
files which find by find
command.
if find "/home/test/" -name "*.csv" -exec grep "pattern" {} \;; then
echo "find it in txt files";
else
echo "not find in txt files";
fi
The program always outputs "find it"
although the conditions are not met.