我有一个用bash编写的源代码,我需要使用对话框来创建终端GUI。我的bash代码有菜单和子菜单。 我有这个代码,我试图使用对话框,但当我试图从主菜单中选择没有发生/发生。
INPUT=/tmp/projekt.txt
while true ;do #a loop so this list will be used again, until the user presses x button
dialog --backtitle "Welcome to MY utility" --title"======MAINMENU=======" --menu "Choices:" 20 50 10 \
"A." " File operations" \
"B." "Directory operations" \
"C." " Process management" \
"D." "Search operations" \
"X." "Exit the program" 2>"${INPUT}"
choice=$(<"${INPUT}")
case $choice in
Adialog --title "File operations" --menu "Choices:" 20 50 10 \
"A." "Copy file" \
"B." "Rename file" \
"C." "Remove file" \
"D." "Edit file" \
"E." "Print file" \
"X." "Return to main menu" 2>"${INPUT}"
choiceA=$(<"${INPUT}")
case $choiceA in
a)
#a place for the functions
functionAA
;;
b)
functionAB
;;
c)
functionAC
;;
d)
functionAD
;;
e)
functionAE
;;
x)
--infobox "Returning to main menu" 10 13; sleep 3; clear;;
;;
*)
echo
echo -e "\e[91mNo option was reconized\e[0m" #Light red color, not exactly the same$
echo
echo "Returning to main menu"
esac
#done
;;