LoginSignup
4
3

More than 5 years have passed since last update.

【シェル】年月を指定してその日付分ループする

Posted at

日付指定で行う処理をまとめてやるのに便利

dailyloop
#!/bin/bash

TARGETMONTH=$1

TARGETDATE="${TARGETMONTH}01"
while [ `echo ${TARGETDATE} | cut -c 1-6` -eq ${TARGETMONTH} ]; do
  【処理記述】
  【処理記述】
  【処理記述】
  TARGETDATE=`date -d "${TARGETDATE} 1 days" '+%Y%m%d'`
done 
4
3
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
4
3