showFlash(){
tput clear
center 10 "$sysName"; boldColor $Brown"$sysName";
center 12 "$sysVersion";echo-n "$sysVersion";
center 14 "$sysAuthor"; color $Green"$sysAuthor";
center 16 "$sysDate";echo-n "$sysDate";
message="Press ENTER to continue..."
center 20 "$message"; color $Cyan"$message"
read -n1 key
}
主菜单
showMain(){
error=0
while :;doif[[$error-eq 0 ]];then
tput clear
center 6 "Main Menu"; boldColor $Brown"Main Menu";
centerMessage 8 30; bold "1: Show books"
centerMessage 10 30; bold "2: Find books"
centerMessage 12 30; bold "3: Add books"
centerMessage 14 30; bold "4: Edit information of books"
centerMessage 16 30; bold "5: Check out books"
centerMessage 18 30; bold "6: Check in books"
centerMessage 20 30; bold "7: Delete books"
centerMessage 22 30; bold "q: Exit"
message='Please inter your choice(1-7 or q):'
inputCol=$(((Width-${
#message})/2+${#message}))
center 24 "$message"; color $Cyan"$message"
fi
read choice
case $choice in
1) showBooks; error=0;;
2) findBooks; error=0;;
3) addBooks; error=0;;
4) editBooks; error=0;;
5) checkOut; error=0;;
6) checkIn; error=0;;
7) deleteBooks;error=0;;[qQ]*) tput clear;exit 0;;*) error $((infoHeight+2))
tput cup $((infoHeight))$inputCol
tput ed; error=1;;
esac
done
}
展示图书
showBooks(){
error=0
while :;doif[$error-eq 0 ];then
tput clear
center 6 "Show books"; boldColor $Brown"Show books"
centerMessage 8 30; bold "1:show books that not borrowed"
centerMessage 10 30; bold "2: show books that borrowed"
centerMessage 12 30; bold "3: show all books"
centerMessage 14 30; bold "q: Main Menu"
message='enter your choice(1-3 or q):'
inputCol=$(((Width-${
#message})/2+${#message}))
center 24 "$message";color $Cyan"$message"
fi
read choice
case $choice in
1) showBook 1;;
2) showBook 2;;
3) showBook 3;;[qQ]