(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.

cat hkeep.cfg
#<Directory to be purge>,<Days to Purge>

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

Source: unix

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.