方法1: 修改文件雙擊反應
參考: https://blog.csdn.net/miffywm/article/details/103382405
chmod +x test.sh
鼠標選中待執行文件,在窗口左上角edit菜單中選擇preference設計雙擊執行快捷鍵,如下圖:
方法2: 設置一個應用
參考: https://blog.csdn.net/DBaiYun/article/details/130291877
準備兩個文件:
- 需要執行的shell文件: test.sh
- 應用文件: test.desktop
test.desktop
內容如下:
[Desktop Entry]
Version=1.0
#展示的應用名稱
Name=test
Comment=test
#下面是調用shell腳本、并添加執行腳本的路徑
Exec=gnome-terminal -e "bash -c '~/Downloads/test.sh;$SHELL'"
Terminal=false
X-MultipleArgs=false
Type=Application
#下面是桌面是logo絕對路徑
# Icon=/home/upload/icon.ico
StartupNotify=true
雙擊test應用即可: