Yaptığım bir betiğim var ve onunla ilgili bir sorunum var: İşlemi duraklatmak ve kullanıcı girişi için beklemek istiyorum. read -p -n 1 $fooKomuta sahip olduğumu sanıyordum ama sistemin bu komutla ilgili sorunları var. İşte benim şu anki betiğim:
#!/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
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!!!!
Ana menüde -n 1 -p "metin buraya gidiyor" girişini okuyabilirsiniz. Ubuntu'ya göre sorunu burada yaşıyorum. Biri bana neyin yanlış gittiğini söyleyebilir mi? Teşekkürler!
#!/usr/bin/env bashveya olarak ayarlanmış olmalı#!/bin/bash.