blob: ee3796eb2519f1ca1789200f597f27446f34af2d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
#!/bin/bash
usage() {
printf "%s\n" \
"generate YYYY-MM-DD dates for a range" \
"usage: $(basename ${0}) -s <start YYYY-MM-DD> -e <end YYYY-MM-DD>"
exit 1
}
while getopts "s:e:h" opts; do
case "${opts}" in
s) start="${OPTARG}";;
e) end="${OPTARG}";;
h) usage;;
*) usage;;
esac
done
if test "${start}" && test "${end}"; then
current="${start}"
while [[ "$current" < "$end" || "$current" == "$end" ]]; do
printf "%s\n" "${current}"
current=$(date -I -d "${current} + 1 day")
done
else
usage
fi
|