Created
July 15, 2019 13:24
-
-
Save jumanjiman/9ceb132afee211d4166ca8ebc43016c4 to your computer and use it in GitHub Desktop.
bash date arithmetic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eEu | |
set -o pipefail | |
do_something() { | |
some_date=$1 | |
echo "$some_date" | |
} | |
# https://stackoverflow.com/a/25701358 | |
# (requires gnu date) | |
d="2014-06-29" | |
until [[ $d > 2014-07-03 ]]; do | |
do_something($d) | |
d=$(date -I -d "$d + 1 day") | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment