Skip to content

Instantly share code, notes, and snippets.

@nyango
Last active August 29, 2015 14:06
Show Gist options
  • Save nyango/d45e55e187c95aa890c9 to your computer and use it in GitHub Desktop.
Save nyango/d45e55e187c95aa890c9 to your computer and use it in GitHub Desktop.
締め切り通知マシン:/etc/profileとかに書き足して使うとGood
#!/bin/bash
cat /etc/hoge_schedule | while read line
do
a=($line)
rest_days=$(echo "`date -d${a[1]} +%j`-`date +%j`" |bc | tr -d '\n')
[ $rest_days -lt 0 ] && rest_days=$(expr $rest_days + 365)
if [ $rest_days -lt 100 ]; then
if [ $rest_days -gt 20 ]; then
echo ""${a[0]}"まであと"$rest_days"日"
else
echo ""${a[0]}"まであと^[[4;31m"$rest_days"日"
fi
fi
done
schedule1 1/19
よてい2 12/25
よてい3 2/13
よてい4 11/2
よてい5 8/2
よてい6 3/30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment