{"version":"1.0","type":"rich","title":"get previous month in shell script","description":"This shell script calculates the previous month for a given date, storing the result in a text file for later use. It reads a year and month from either command-line arguments or a previously saved file, then uses the GNU `date` command with the `--date` option to subtract one month from the 15th day of the specified month. The script writes the computed year and month back to a file named with a `last_` prefix, enabling sequential month calculations across runs. It relies on Bash parameter expansion for string slicing and file redirection for persistence.","provider_name":"VizHub AI Studio","provider_url":"https://next.vizhub.com","html":"<iframe src=\"https://next.vizhub.com/viz/gist-5c29852b985b7f07d98c?mode=embed\" width=\"960\" height=\"500\" scrolling=\"no\" frameborder=\"1\"></iframe>","width":960,"height":500,"cache_age":3600}