我已经编写了一个脚本来遍历Solaris中的目录。该脚本查找超过30分钟并回显的文件。但是,无论文件有多大,我的if条件总是返回true。有人请帮助解决这个问题。如何检查unix中的文件是否超过30分钟
for f in `ls -1`;
# Take action on each file. $f store current file name
do
if [ -f "$f" ]; then
#Checks if the file is a file not a directory
if test 'find "$f" -mmin +30'
# Check if the file is older than 30 minutes after modifications
then
echo $f is older than 30 mins
fi
fi
done
'if test'find“$ f”-mmin + 30'' should be'[$(fi nd“$ f”-mmin +30)]' – fedorqui