In a bash script, I have a variable like :
date=20140131
which means 31 Jan 2014. How can I add one day to it? I mean how can I add one value to "date" to change it to "20140201" (1 Fab 2014) not "20140132"
with GNU date
$ d=20140131
$ date -d "$d +1 day" +%Y%m%d
20140201
If you don't have gnu date, here is the script I used mostly (refer http://www.unix.com/16559-post2.html )
so if you need get the next day of 20140131, you can run:
datecalc -a 2014 01 31 + 1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With