Here is an example of looping over dates from 2017-10-22 to 2017-12-31.
#!/bin/bash START=2017-10-22 END=2017-12-31 CURRENT=$START while true; do echo $CURRENT if [ "$CURRENT" = "$END" ]; then break fi CURRENT=`date -d "$CURRENT 1day" +%Y-%m-%d` done
NOTE
date -d "2017-12-01 1day"
returns a next day of 2017-12-01- +%Y-%m-%d is a format
- See more options in GNU Coreutils: date invocation
- 作者: Josh Thompsons
- 発売日: 2017/05/26
- メディア: Kindle版
- この商品を含むブログを見る