Date Arithmetic in Bash
GNU date supports relative expressions — yesterday, +7 days, etc.
Author:
chris
// Language: Bash
#!/usr/bin/env bash
set -euo pipefail
today=$(date +%F)
yesterday=$(date -d 'yesterday' +%F)
next_week=$(date -d '+7 days' +%F)
printf 'today=%s\nyesterday=%s\nnext_week=%s\n' \
"$today" "$yesterday" "$next_week"