我有一个基本菜单可以完成已经为我设置的任务,我有菜单要显示和功能可以工作,但是,当用户选择选项 4 时,结果只会在终端中闪烁一瞬间,而且如果他们选择了不正确的值,错误消息会闪烁,我需要他们两个都留在原地。有任何想法吗?
#!/bin/bash
#
# Script to perform some simple tasks
#
chmod 755 TaskB.sh
while:
do
clear
echo "*********************"
echo "* Tools *"
echo "*********************"
echo "* [1] Install gnome-disk-utility and gparted *"
echo "* [2] Create CET103Demo.txt *"
echo "* [3] Delete CET103Demo.txt *"
echo "* [4] Search BASH *"
echo "* [0] Exit/Stop *"
echo "*********************"
echo -n "Enter your menu choice [0-4]: "
read yourch
case $yourch in
1) sudo apt-get install gparted gnome-disk-utility ;;
2) cat > Desktop/CET103Demo.txt;;
3) rm Desktop/CET103Demo.txt;;
4) grep -H -r "BASH" /home/mintuser/.profile ;;
0) exit 0;;
*) echo "Oooops!!! Please select choice 1,2,3,4 or 0";
echo "Press Enter to continue..."; read ;;
esac
done