I'm trying to find files using -mtime +(variable)
, but everytime I execute below in GNU I'm getting an error:
find: missing argument to `-mtime'
Tried in AIX and it worked.
#------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
Adding an
echo line
may help you figure out the problem: