yesterday date

HI All,
I am trying so long to find the yesterday's date to run a script but i failed

kinldy share the command to find yesterday's date in ksh

i tried with

date --date='1 day ago'

but it displaying error

your help will highly apeerciated.

Thanks

'Kindly' look at the FAQs and/or at the bottom of your thread for 'Topics you might find helpful'.

date -d yesterday

This is GNU-ism - doesn't work for all the systems.

Yep. I sort of assumed he was using GNU because of the "--date" option on the date program he was using.

well....isn't the presence of an 'error' an indication of the opposite - that it is NOT a GNU date?

yes - I apologize profusely and thank you for pointing out how churlish I have been.
I also acknowledge that the FAQ's do indeed provide a much better and factually correct answer.

Cheers.

Using ksh93 builtin

#!/usr/bin/ksh
# yesterday
# arg format 2011-01-01
# default is today
timestamp=$(printf "%(%Y-%m-%d+%H:%M:%S)T" now)
# arg is some day value
[ "$1" != "" ] && timestamp=$(printf "%(%Y-%m-%d+%H:%M:%S)T" "$1+00:00:00")
timeint=$(printf "%(%#)T" "$timestamp")
((daysec=24*60*60))
((yesterday=timeint - daysec))
printf "yesterday %(%Y-%m-%d)T \n" "#$yesterday"

Example:

yesterday
yesterday 2011-01-01