我有这个菜单脚本工作。我应该编写一个代码,将在日志文件中记录菜单脚本使用了多少次以及菜单中使用了哪些选项。
#\usr\bin\bash
clear;
echo "Welcome"
while [ $option!=7 ]
do
clear;
printf "\n\t\tMenu Principal"
printf "\n1)Pega 2 "
printf "\n2)Pega 3 "
printf "\n3)Pega 4 "
printf "\n4)Loto "
printf "\n5)Revancha "
printf "\n6)Ver Log File "
printf "\n7)Salir "
read option
case $option in
'1')
clear;
echo "Los numeros del Pega 2 son : "
awk 'BEGIN { for(i=1;i<=2;i++) print int(9*rand())}'>temp
cat temp ; sleep 3
;;
'2')
clear;
echo "Los numeros del Pega 3 son : "
awk 'BEGIN { for(i=1;i<=3;i++) print int(9*rand())}'>temp
cat temp ; sleep 3
;;
'3')
clear;
echo "Los numeros del Pega 4 son : "
awk 'BEGIN { for(i=1;i<=4;i++) print int(9*rand())}'>temp
cat temp ; sleep 3
;;
'4')
clear;
echo "Los numeros de la Loteria son : "
awk 'BEGIN { for(i=1;i<=6;i++) print int(46*rand())}'>temp
cat temp ; sleep 5
;;
'5')
clear;
echo "Los numeros de la Revancha son : "
awk 'BEGIN { for(i=1;i<=6;i++) print int(46*rand())}'>temp
cat temp ; sleep 5
;;
'6')
clear;
;;
'7')
clear;
echo "Gracias por participar! " ; sleep 2
exit
;;
esac
done
在选项 6 中是日志文件应该去的地方。任何指针?