我尝试使用-mtime +(variable)
查找文件,但每次我在GNU中执行下面时都会收到错误:
找到:缺少`-mtime'
的参数
在AIX中尝试并且它有效。
#------config-------#
cat hkeep.cfg
#<Directory to be purge>,<Days to Purge>
/home/fbmadm/logs,15
#------MAIN-------#
for line in `cat hkeep.cfg | grep -v "#"`;do
hkDir=`echo $line | awk -F"," '{print $1}'`
hkCnt=`echo $line | awk -F"," '{print $2}'`
find $hkDir -mtime +$hkCnt
done
答案 0 :(得分:1)
添加echo line
可能会帮助您解决问题:
for line in `cat hkeep.cfg | grep -v "#"`;do
hkDir=`echo $line | awk -F"," '{print $1}'`
hkCnt=`echo $line | awk -F"," '{print $2}'`
echo find $hkDir -mtime +$hkCnt
find $hkDir -mtime +$hkCnt