LoginSignup
18
19

More than 5 years have passed since last update.

シェル・スクリプトで日付を加算しながら何か処理をする

Posted at

例えば、オプションに日付を指定して起動するバッチで使える。

サンプルスクリプト
#!/bin/bash
START_DATE="20140101"
END_DATE="20140403"

for (( DATE=${START_DATE} ; ${DATE} < ${END_DATE} ; DATE=`date -d "${DATE} 1 day" '+%Y%m%d'` )) ; do
  echo ${DATE}
done
18
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
19