我试图制作一个zenity菜单但我遇到一些问题让它打开,当我在终端中运行它不会工作。
我的代码
#!/bin/bash
#GUI for TaskB menu
chmod 755 TaskC.sh
temp='mktemp -t temp.XXXXXX'
temp2='mktemp -t temp2.XXXXX'
function software {
sudo apt-get install gparted gnome-desk-utility
zenity --text-info --title "Install Software" --filename=$temp
--width 750 --height 10}
function create {
touch > Desktop/CET103Demo.txt
zenity --text-info --Title "Create CET103Demo.txt" --filename=$temp
--width 300 --height 500}
function delete {
rm Desktop/CET103Demo.txt
zenity --text-info --title "Remove CET103Demo.txt" --filename=$temp
--width 300 --height 500}
function search {
grep -H -r "BASH" /home/mintuser/.profile
zenity --text-info --Title "Search BASH" --filename=$temp
--width 300 --height 500}
while [ 1 ]
do
zenity --list --radiolist --title "TaskC Menu" --column "Select" --column "Menu Selection"
FALSE "Install Software" FALSE "Create file" FALSE "Remove File" FALSE "Search BASH" False "Exit" > $temp2
if [ $? -eq 1 ]
then
break fi
selection ='cat $temp2'
case $selection in
"Install Software")
software;;
"Create File")
create;;
"Remove File")
delete;;
"Search BASH")
search;;
Exit)
break ;; *)
zenity --info "Sorry, invalid selection" esac
done $
我收到一些错误,说bash命令无法识别,比如sudo apt-get和touch,基本上没有我的实际功能工作,菜单本身也不会显示