I\'ve got a shell script which does the following to store the current day\'s date in a variable \'dt\':
date \"+%a %d/%m/%Y\" | read dt echo ${dt} >
date \"+%a %d/%m/%Y\" | read dt echo ${dt}
Try the following method:
dt=`case "$OSTYPE" in darwin*) date -v-1d "+%s"; ;; *) date -d "1 days ago" "+%s"; esac` echo $dt
It works on both Linux and OSX.