What I am trying to do it check certain files in a directory and see if they are created today or yesterday. I know that you can use find, this is part of a larger script.
#!/bin/bash
volume="/home/casper/data/vol14/"
dirLimit="casper_limit/"
dirConsu="casper_consumption/"
nowMonth=$(/bin/date +'%b' -d 'now')
preMonth=$(/bin/date +'%b' -d 'last month')
tradeDay=$(/bin/date -I)
previDay=$(/bin/date -I -d 'yesterday')
limtfile="CASPER_LIMIT_01*.journal"
cd $volume$limit
for journal in $limtfile
do
modtime=$(/bin/date -I -r $journal)
if [[ "$modtime" == "$tradeDay" || "$previDay" ]] ; then
echo "$journal is $modtime"
fi
done
Presently the "or" statement does not work, it prints out ever file. In addition, I picked up the date -I a while ago, which prints out the day in this format YYYY-MM-DD. I do not see the '-I' flag in the man pages. Is there a shortcut flag for YYYY.MM.DD ? Does anyone know what these shortcuts are called and is there a list of these shortcut delimiters like '-I'.
Aucun commentaire:
Enregistrer un commentaire