运行.sh文件时如何更改默认操作?


Answers:


5

使每个.desktop文件都在“在终端中运行”或“ 显示运行”中,您可以为每个sh文件设置默认操作。

授予每个.desktop文件执行权限。

例如:

  • 在终端中运行

文件名:sample-term.desktop

[Desktop Entry]
Type=Application
Name=Run in terminal
Exec='/fullpath_to_script/sample1.sh'
Terminal=true

单击此文件,它将可以在终端中运行sample1.sh。

  • 显示

文件名:sample-edit.desktop

[Desktop Entry]
Type=Application
Name=Edit script
Exec=gedit '/fullpath_to_script/sample2.sh'
Terminal=false

单击此文件,将可以通过来编辑sample2.sh gedit

文件名:sample-run.desktop

[Desktop Entry]
Type=Application
Name=Run script
Exec='/fullpath_to_script/sample3.sh'
Terminal=false

单击此文件,它将能够运行sample3.sh。


By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.