|
Here the requirement is that I provide a date in some format for example (yyyy-mm-dd) and script should give me date of previous day of given date i.e if I provide "Date" , I should get (Date-1). Take a look at following script:
#!/bin/bash scheduled_date=2011-08-07 # format is yyyy-mm-dd
datevalue=`date -ud $scheduled_date "+%s"` datevalue=$(($datevalue-86400)) outdate=`date [email protected]$datevalue "+%Y-%m-%d"` echo $outdate If you execute it output will be 2011-08-06 So it solves our purpose  However , if you want to get yesterday date , following command will help: $date -d "-1 day" "+%Y-%m-%d"
|