停止更新,敏捷测试及TestOps解决体系,关注订阅号TestOps
Linux下简单的判断目录中是否有新文件的Shell
上一篇 /
下一篇 2011-12-30 12:04:46
/ 个人分类:自动化测试
在做dailybuild的时候经常需要判断是不是有新版本出现,所以就写了这样一个
shell。
该shell脚本可以帮助你判断当前目录下是否有新文件出现,旧文件信息保存在oldfiles.log内。
no/HfIezU!H0
if [ -f oldfiles.log ]
then
newfile=` ls -t | head -1 `
cat oldfiles.log | grep $newfile >/dev/null
if [ $? -eq 1 ]
then
echo "there is a new file: $newfile"
echo $newfile >> oldfiles.log
else
echo "there is no new files"
fi
51Testing软件测试网hJ%r:k)e n\7{*qO%b
else
ls -t -r > oldfiles.log
echo "cache old files info"
fi
ca$Y1h3d.]Qg&}h1l/x0
51Testing软件测试网X[/rb Va|N
收藏
举报
TAG: