I have a scenario where I need to calculate the date (yyyy-mm-dd) for X days from today's date in Linux. X is a user-input.
I tried the following:
X="-30"
date -d '$X day' '+%Y-%m-%d'
But this produces the following error:
date: invalid date ‘$X day’
How can I achieve this?
Thanks in advance!