我正在创建一个脚本来检查目录中的3个文件,获取它们中的行数和邮件,如果行存在。我必须发送只有一个邮件,如果任一这些文件有计数,我最终发送3封邮件。shell脚本检查具有不同名称的多个文件
For Ex。我有这些文件
process_date.txt
thread_date.txt
child_date.txt
荫做这样的事情
$1= process_date.txt
$2= thread_date.txt
$3= child_date.txt
if [ -f $1 ]
then
count1=`wc-l < $1`
if $count1 -ne 0 then mailx abc.com
fi
fi
if [ -f $2 ]
then
count2=`wc-l < $2`
if $count2 -ne 0 then mailx abc.com
fi
fi
if [ -f $3 ]
then
count3=`wc-l < $3`
if $count3 -ne 0 then mailx abc.com
fi
fi
谢谢@pwes ... :) – Naaz