0

我正在做一个 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
4

1 回答 1

0
#!/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
于 2013-01-15T15:58:54.233 回答