我有一个正在制作的脚本,但我遇到了一个问题:我想暂停执行并等待用户输入。我以为我有这个read -p -n 1 $foo命令,但系统有这个命令的问题。这是我当前的脚本:
#!/bin/sh
# Ititialization
mainmenu () {
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 …Run Code Online (Sandbox Code Playgroud) bash ×1