Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
#対象の曜日を指定。0が日曜日。
targetDay=2
#曜日取得
day=`date +%w`
#対象の曜日までの日数
numOfdays=`expr $targetDay - $day`
#対象の日付を取得
date=`date -d "$numOfdays days" +"%Y-%m-%d"`