Skip to content

Instantly share code, notes, and snippets.

@cupracer
Created July 26, 2021 18:34
Show Gist options
  • Save cupracer/c31fe82f87a5a77de810d05bb6ec4fd0 to your computer and use it in GitHub Desktop.
Save cupracer/c31fe82f87a5a77de810d05bb6ec4fd0 to your computer and use it in GitHub Desktop.
Generate dates in Bash
#!/bin/bash
# Simple one-liner to increase and print dates. To be used in scripts.
# Current command starts today and prints next 100 dates.
#
# Output:
# 2021-07-26
# 2021-07-27
# 2021-07-28
# ...
for i in $(seq 0 10); do date -d "$(date +%Y-%m-%d) $i days" +%Y-%m-%d; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment