Skip to content

Instantly share code, notes, and snippets.

@hawaku
Created March 11, 2014 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hawaku/9481184 to your computer and use it in GitHub Desktop.
Save hawaku/9481184 to your computer and use it in GitHub Desktop.
linuxのシェルスクリプトで日付でループする ref: http://qiita.com/treeclad/items/2f0a8454bbead2f070d2
#!/bin/sh
#
# YYYY-MM-DD
#
STARTDATE=2014-02-20
ENDDATE=2014-03-02
CURRENTDATE=$STARTDATE
while [ 1 ] ; do
# 処理
echo $CURRENTDATE
if [ $CURRENTDATE = $ENDDATE ] ; then
break
fi
CURRENTDATE=`date -d "$CURRENTDATE 1day" "+%Y-%m-%d"`
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment