我怎样才能知道/bin/sh中的文件是否早于30分钟? [英] How can I tell if a file is older than 30 minutes from /bin/sh?
本文介绍了我怎样才能知道/bin/sh中的文件是否早于30分钟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何编写脚本来确定文件在/bin/sh中是否早于30分钟?
How do I write a script to determine if a file is older than 30 minutes in /bin/sh?
很遗憾,系统中不存在stat
命令.这是一个旧的Unix系统, http://en.wikipedia.org/wiki/Interactive_Unix
Unfortunately does not the stat
command exist in the system. It is an old Unix system, http://en.wikipedia.org/wiki/Interactive_Unix
不幸的是,Perl没有安装在系统上,客户也不想安装它,也没有其他东西.
Perl is unfortunately not installed on the system and the customer does not want to install it, and nothing else either.
推荐答案
这是使用find
的一种方法.
if test "`find file -mmin +30`"
如果所涉及的文件包含空格或特殊字符,必须用find
命令加引号.
The find
command must be quoted in case the file in question contains spaces or special characters.
这篇关于我怎样才能知道/bin/sh中的文件是否早于30分钟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文