shell:按字符串查找文件(my first script!)

file=$(find /root -maxdepth 2 -type f)
  
OLD_IFS="$IFS"
IFS=" "
arr=($file)
IFS="$OLD_IFS"
 
for s in ${arr[@]}
do
if [  $(cat$s | grep "abcdefghijklmn") ] ;then
echo"$s"
fi
done

你可能感兴趣的:(shell,查找文件)