familiar with:
date -d '1 hour ago'
well, it will work on the Linux command line, but no such luck on the Mac
here is the code you need if your script is to work on both OSes:
OS=`uname -a`
if [[ $OS == Darwin* ]]
then
TODAY=`date -v-1H +"%Y-%m-%d.%H"`
else
TODAY=`date -d '1 hour ago' +"%Y-%m-%d.%H"`
fi
No comments:
Post a Comment