2.メニュー画面のスクリプト
#!/usr/bin/bash
#----- Data File Setting --------------
DIR=/home/$USER/diary
DATA_FILE=/$DIR/work.txt
#--------------------------------------
if [ ! -d $DATA_FILE ];then
mkdir -p $DIR
touch $DATA_FILE
fi
#- Start ------------l----------
while
clear
echo -e $'[\e[33;01;47mWork System Menu On KURAFUTO\e[00m]'
cal -3
echo '[本日の予定]--------------------------------'
grep `date +%Y/%m/%d` "$DATA_FILE" | grep 計画
echo '--------------------------------------------'
echo '[過去の今日]--------------------------------'
grep `date +%Y/%m/%d -d '1 year ago'` "$DATA_FILE" | grep 結果
grep `date +%Y/%m/%d -d '2 year ago'` "$DATA_FILE" | grep 結果
echo '--------------------------------------------'
echo '[向こう2ヶ月の予定]------------------------'
#for day in `seq -w 1 31`
#do
# str="${day} day"
# grep `date +%Y/%m/%d -d "$str"` "$DATA_FILE"
#done
for month in `seq -w 0 1`
do
str="${day} day"
str1="${month} month"
str2=`date '+%Y/%m/01'`
str3=`date '+%m' -d "$str2 $str1"`
str4=`date '+%Y/%m' -d " $str2 $str1"`
# This line is for test
#echo "$str2"
#echo "$str3"
#echo "$str4"
grep '計画'.'*'"$str4" "$DATA_FILE" | sort
grep '計画'.'*毎年'"$str3" "$DATA_FILE" | sort
done
echo '--------------------------------------------'
read -p $'[ \e[32m1.データ入力\e[0m | \e[32m2.データ検索と修正\e[0m | \e[32m3.DATABASE保守\e[0m | \e[32mq.終了\e[0m ]:' choice
do
case $choice in
1)
event.sh
;;
2)
eventm.sh
;;
3)
sed '/^$/d' "$DATA_FILE"
nano "$DATA_FILE"
;;
q)
echo -e '\e[31m終了\e[0m'
cp "$DATA_FILE" "$DATA_FILE.backup"
exit 0
;;
*) echo -e '\e[31m入力誤り\e[0m'
;;
esac
done
続きあり(入力画面)
コメント