LoginSignup
1
0

More than 5 years have passed since last update.

macのシェルスクリプトで特定の日付から特定の日付を一日ずつ出力する

Posted at

忘れそうなので自分用のメモ
macはBSDであるためGNU版のコマンドが入ってないことに気がつくまでに時間がかかってしまった

下記20171001から20171031の日付を出力する例

#!/bin/sh

d="20171001"

while [ "$d" != "20171031" ]; do
    echo $d
    d=$(date -v+1d -j -f "%Y%m%d" "$d" "+%Y%m%d")
done

出力結果

20171001
20171002
・
・
・
・
20171031
1
0
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
1
0