У меня есть сценарий, который я создаю, и у меня есть проблема с ним: я хотел бы приостановить выполнение и дождаться ввода пользователем. Я думал, что у меня все получилось с помощью read -p -n 1 $foo команда, но у системы возникли проблемы с этой командой. Вот мой текущий сценарий:
#!/bin/sh# Ititializationmainmenu () { echo "Press 1 to update your system" echo "Press 2 to install samba" echo "Press 3 to install vsFTPd" echo "Press 4 to install the current version of Webmin" echo "Press 5 to configure samba for Active Directory" echo "Press x to exit the script" read -n 1 -p "Input Selection:" mainmenuinput if [ "$mainmenuinput" = "1" ]; then updatesystem elif [ "$mainmenuinput" = "2" ]; then installsamba elif [ "$mainmenuinput" = "3" ]; then installvsftpd elif [ "$mainmenuinput" = "4" ]; then installwebmin elif [ "$mainmenuinput" = "5" ]; then configuresambaforactivedirectory elif [ "$mainmenuinput" = "x" ];then quitprogram elif [ "$mainmenuinput" = "X" ];then quitprogram else echo "You have entered an invallid selection!" echo "Please try again!" echo "" echo "Press any key to continue..." read -n 1 clear mainmenu fi}# This builds the main menu and routs the user to the function selected.mainmenu# This executes the main menu function.# Let the fun begin!!!! WOOT WOOT!!!!Вы можете заметить, что в mainmenu функция the read -n 1 -p "text goes here" вход. Вот где у меня возникла проблема в соответствии с ubuntu. Может кто-нибудь сказать мне, что происходит не так? Спасибо!