• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

A month ago

March 19, 2019

How to get last month’s value. Useful with Bash scripts.

LASTMONTH = $(date +%Y%m -d '1 month ago')
echo $LASTMONTH
# Output is ...
201902

LASTMONTH = $(date +%Y%m -d '1 month ago') echo $LASTMONTH # Output is ... 201902

Filed Under: Linux Tagged With: bash, date, month, scripts

Search This Website

Subscribe Via Email

  • Home
  • About
  • Archives

Copyright © 2023