[英]Check latest file updates in directory on linux using bash shell scripting
我有linux bash shell脚本的基本知识,现在我面临的问题如下:
所以,任何人都可以帮助我。
还有一些概念证明:
while true;
do
func1();
func2();
check file is updated or not
if updated ; then
break;
else
continue;
您可能需要stat
命令。 请查看man stat
以了解您的工作原理。 您想要查找“modtime”或“上次修改数据的时间”选项。 对于我的那个将是stat -c%Y file
。 像basemodtime=$(stat -c%Y file)
循环,前modtime=$(stat -c%Y file)
后func2()
然后if [ $modtime != $basemodtime ]; then
if [ $modtime != $basemodtime ]; then
检测“更新”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.