Skip to content

Instantly share code, notes, and snippets.

@ParagDoke
Last active February 16, 2019 06:04
Show Gist options
  • Save ParagDoke/b93f07a2ec1d90352189036ffe316141 to your computer and use it in GitHub Desktop.
Save ParagDoke/b93f07a2ec1d90352189036ffe316141 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# vim:filetype=sh:tabstop=4:shiftwidth=4:expandtab:
set -e
start_at_year=2019
start_at_month=1
stop_at_year=2017
stop_at_month=10
y=${start_at_year}
m=${start_at_month}
for y in $(seq ${y} -1 ${stop_at_year}); do
for m in $(seq ${m} -1 0); do
if [ ${m} -eq 0 ]; then
m=12
break
fi
padded_month=$(date --date ${start_at_year}-${m}-1 +%m)
echo ${y}-${padded_month}
if [[ ${y} -eq ${stop_at_year} && ${m} -eq ${stop_at_month} ]]; then
break
fi
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment