The shell script uses perl to find the date 'n' days back
#!/bin/ksh # this script is used in date subtraction. # the script uses perl command # Similarly, the date before â??nâ?? days can be # obtained by multiplying 86400 * n in the # place of 86400 Days=1 echo " Yesterday's date... " a=`perl -e '$d = time(); @f = localtime($d - 86400); printf "%04d %02d %02d ",$f[5]+1900, $f[4]+1, $f[3]; ' $Days` echo $a echo " Two days back date... " b=`perl -e '$d = time(); @f = localtime($d - 172800); printf "%04d %02d %02d ",$f[5]+1900, $f[4]+1, $f[3]; ' $Days` echo $b