Maybe the title is quite confusing so i'll try to explain what i have done until now. First of all i have build the list of directories i want to investigate with the code below:$MDIR=/home/user/scripts/fcronDIRS=`ls -l $MDIR | egrep '^d' | awk '{print $9}' | grep ^$ts-`The DIRS list now contain directory names of the form :NETGEAR-2013-06-30NETGEAR-2013-07-01........NETGEAR-2013-05-05Now i need to check all those directories (contained in list DIRS) and i need to find one that is newer than 1 month before now (e.g 27 or 29 days). In case i find one match i need to exit the script.In 'pseudocode' i would write:for dir is DIRS:    if dir is newer than 30 days old:       exit the script    else:       continueMy difficulty is in translating just the above 'pseudocode' in a bash script./////Latest Update/////OK i have updated the part with the pseudocode with this:    for DIR is $DIRS;    do    if (( $(stat -c %Y $dir) < $(date +%s) - 3600*24*30 )); then        echo exiting!!           exit    else        continue    fi    doneBut now i am getting this : line 40: syntax error: unexpected word (expecting do)
I need to check a list of directories if it contains a directory newer than 1 month before now
bash;bash script
Try doing this :dirs='dir1 dir2 dir3'for dir is $dirs; do    if (( $(stat -c %Y $dir) < $(date +%s) - 3600*24*30 )); then       exit    else       continue    fidone