当我双击可执行文件时,单击“运行”后它不会运行。我已经用几个 .sh 文件和一些下载的软件尝试过,有人知道为什么吗?
我需要运行的特定 .sh 文件是一个 zenity 菜单。当我在终端尝试时,它只是说
sh: Can't open TaskC.sh
这是我使用后
sh TaskC.sh
在文件中,我使用了属性使其可执行并使用
chmod 755 TaskC.sh
- 有人知道如何在没有终端的情况下运行它吗?
- 有人知道如何让 .sh 在终端中运行吗?
我的代码以防万一出现问题
#!/bin/bash
#GUI for TaskB menu
chmod 755 TaskC.sh
temp='mktemp -t temp.XXXXXX'
temp2='mktemp -t temp2.XXXXX'
function software {
sudo get-apt 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 $
非常感谢
最佳答案
尝试使用./TaskC.sh
当然,您必须与脚本位于同一目录中。如果你想从任何地方执行它,你需要将它添加到你的路径(参见KevinDTimm的答案)
关于linux - Linux Mint 中的“RUN”不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15546800/