(GNU) find -mtime using variables

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


Source: unix

Leave a Reply