Dea*_*x17 4 command-line scripts shortcuts .desktop
所以我尝试制作一个执行非常简单的 shell 脚本的桌面快捷方式。但是当我双击/右键单击-> 执行它时,它什么也不做。(或者至少我认为它什么都不做)
下面是我的快捷方式和 shell 脚本的外观:注意快捷方式的“终端”设置为 1,我希望这意味着它会在新的终端窗口中打开 shell 脚本..(我已经打开了几个终端,但还没有准备好用于使用(运行脚本))
捷径:
[Desktop Entry]
Version=1.0
Type=Application
Name=Test
Comment=Test
Exec=/home/(myusername)/test/test.sh
Icon=utilities-terminal
Terminal=true
StartupNotify=false
GenericName=Test
Run Code Online (Sandbox Code Playgroud)
外壳脚本:
#!/bin/sh
# (I tried both, /bin/bash and /bin/sh)
echo "hi"
Run Code Online (Sandbox Code Playgroud)
桌面条目和 shell 脚本都应该具有可执行权限。做:
$ chmod +x path_to_shortcut/shortcut.desktop
$ chmod +x path_to_script/test.sh
Run Code Online (Sandbox Code Playgroud)
更改脚本权限的另一种方法是右键单击它,转到Properties > Premissions并选中Allow execution file as program。