1
Fork 0

Move the date-last-month-year to a function.

This commit is contained in:
Bauke 2023-05-02 11:13:08 +02:00
parent 87ca8e8400
commit f603be4cef
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
2 changed files with 10 additions and 1 deletions

View File

@ -44,7 +44,7 @@ restic-b2 check
* Monthly music library backup: * Monthly music library backup:
```zsh ```zsh
restic-b2 backup --tag "$(date -d "$(date +'%Y-%m-01') -1 day" +'%B %Y')" ~/Beets restic-b2 backup --tag "$(date-last-month-year)" ~/Beets
``` ```
* KeePassXC database: * KeePassXC database:

View File

@ -1,3 +1,12 @@
# Returns the previous month as "Month Year" (ie. "April 2023").
# date-last-month-year
date-last-month-year () {
# The inner date "+'%Y-%m-01'" gets the date of the current month with 01 as the day.
# Then that date has 1 day subtracted (date -d ... -1 day).
# And finally "+'%B %Y'" gets the resulting date as the month and year.
date -d "$(date +'%Y-%m-01') -1 day" +'%B %Y'
}
# Copies a section from a video using ffmpeg. # Copies a section from a video using ffmpeg.
# extract-clip <input file> <start timestamp> <end timestamp> <output file> # extract-clip <input file> <start timestamp> <end timestamp> <output file>
extract-clip () { extract-clip () {