Skip to content

Instantly share code, notes, and snippets.

@shiraji
Last active December 14, 2015 23:39
Show Gist options
  • Save shiraji/5167452 to your computer and use it in GitHub Desktop.
Save shiraji/5167452 to your computer and use it in GitHub Desktop.
#!/bin/sh
#対象の曜日を指定。0が日曜日。
targetDay=2
#曜日取得
day=`date +%w`
#対象の曜日までの日数
numOfdays=`expr $targetDay - $day`
#対象の日付を取得
date=`date -d "$numOfdays days" +"%Y-%m-%d"`
echo $date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment