17 lines
370 B
Bash
Executable file
17 lines
370 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# outputs a range of days (as formatted by `date +%F`), relative to today
|
|
# examples:
|
|
#
|
|
# - `date-range -6 0` outputs the last 7 days, including today
|
|
# - `date-range 1 30` outputs the next 30 days
|
|
|
|
set -euo pipefail
|
|
|
|
from=${1:-"-7"}
|
|
to=${2:-"0"}
|
|
now=${3:-"$(date +%s)"}
|
|
|
|
for d in $(seq -- "$from" "$to"); do
|
|
date +%F -d @$(($now + 60 * 60 * 24 * $d))
|
|
done
|