Last active
August 29, 2015 14:06
-
-
Save nyango/d45e55e187c95aa890c9 to your computer and use it in GitHub Desktop.
締め切り通知マシン:/etc/profileとかに書き足して使うとGood
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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