How to get yesterday and day before yesterday in linux?
linux, shell, unix
Solution
Here is another one way,
For yesterday,
date -d '-1 day' '+%Y%d%m'
For day before yesterday,
date -d '-2 day' '+%Y%d%m'
Problem
I want to get sysdate -1 and sysdate -2 in variable and echo it. I am using below query which gives todays date as output. ``` #! /bin/bash tm=$(date +%Y%d%m) echo $tm ``` How to get yesterday and day before yesterdays date?