使用find、cat和if编写shell脚本

使用find、cat和if编写shell脚本,shell,if-statement,grep,cat,Shell,If Statement,Grep,Cat,我正在做一个scipt来搜索一个带有年龄的日志文件,并比较谁在日志中有一个文本字符串,如果继续生成一个函数是正确的,但没有影响。我很感激任何建议或帮助 #!/bin/bash file= find /AUX/backup/log/ -iname "*.log" -daystart -type f -mtime 1 if cat $file | grep -qw “INF - Status = completed." then echo "there is OK" else echo

我正在做一个scipt来搜索一个带有年龄的日志文件,并比较谁在日志中有一个文本字符串,如果继续生成一个函数是正确的,但没有影响。我很感激任何建议或帮助

#!/bin/bash
file= find /AUX/backup/log/ -iname "*.log" -daystart -type f -mtime 1
if cat $file | grep -qw “INF - Status = completed."  
then
  echo "there is OK" 
else
  echo "there is KO" 
fi
#/bin/bash
file=`find/AUX/backup/log/-iname“*.log”-daystart-type f-mtime1`
如果grep-qw“INF-Status=completed.”<$file
然后
回音“没有问题”
其他的
回声“有柯”
fi

请添加解释,很难发现添加的“字符…”(即使使用语法突出显示…)
#!/bin/bash
file=`find /AUX/backup/log/ -iname "*.log" -daystart -type f -mtime 1`
if grep -qw “INF - Status = completed."  < $file
then
  echo "there is OK" 
else
  echo "there is KO" 
fi