Answer the question
In order to leave comments, you need to log in
How to make case work with a value greater than 1?
Guys, tell me how to make case on bash work more than 1 so that you can write 12 and point 12 is completed, just now you start writing and it immediately selects a value from 0-9 and that's it
function menu {
clear
echo
echo -e "\t\t\tМеню скрипта\n"
echo -e "\t1. Пинговать ya.ru"
echo -e "\t2. Информация об интерфейсах"
echo -e "\t3. Информация о памяти"
echo -e "\t0. Выход"
echo -en "\t\tВведите номер раздела: "
read -n 1 option
}
#Используем цикл While и команду Case для создания меню.
while [ $? -ne 1 ]
do
menu
case $option in
0)
break ;;
1)
ping_ya ;;
2)
ifconfig ;;
3)
meminfo ;;
*)
clear
echo "Нужно выбрать раздел";;
esac
echo -en "\n\n\t\t\tНажмите любую клавишу для продолжения"
read -n 1 line
done
clear
Answer the question
In order to leave comments, you need to log in
case "$1" in
start) startme ;;
stop) stopme ;;
restart) stopme; startme ;;
*) echo "usage: $0 start|stop|restart" >&2
exit 1
;;
esac
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question