学习笔记:
目的:查找当前文件夹下7小时以内的文件,如果有文件打印”successful”,否则打印“fail”
cur_time=$(date "+%Y-%m-%d-%H")
#cur_time='12-06'
echo $cur_time
if
# ls -lrt --time-style '+%Y-%m-%d-%H' | grep $cur_time
ls -lrt --time-style='+%Y-%m-%d-%H' | grep $cur_time >/dev/null
then
echo "exist file $?"
else
echo "no exist file $?"
fi
if
find . -cmin -420 -name 'dail*' -exec ls -lrt {} \; | grep -v '^d' >/dev/null
then
echo "successful"
else
echo
"fail"
fi