Skip to content

Instantly share code, notes, and snippets.

@aigarius
Forked from chluehr/date_loop.sh
Last active August 29, 2015 14:20
Show Gist options
  • Save aigarius/e7b2a798ef1dead45f93 to your computer and use it in GitHub Desktop.
Save aigarius/e7b2a798ef1dead45f93 to your computer and use it in GitHub Desktop.
One line date looper script in bash with parallelism option
#!/bin/bash
start="2012-01-20" end="2012-03-02" now=$start; while [ "$now" != "$end" ]; do now=`date +"%Y-%m-%d" -d "$now + 1 day"`; echo $now ;done
sh -c 'start="2012-01-20" end="2012-03-02" now=$start; while [ "$now" != "$end" ]; do now=`date +"%Y-%m-%d" -d "$now + 1 day"`; echo $now ;done' | xargs -n 1 -P 5 -i echo {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment