如何通过双击在 Linux 上运行脚本 [英] How do I run a script on Linux just by double clicking it
问题描述
我在文件上编写了一个脚本(基本上是 Ubuntu 终端的命令).是的,代码以
I have a script written (which are basically the commands for the terminal for Ubuntu) on a file. Yes, the code starts with
#!/bin/bash
我如何通过双击运行这个脚本?它可以使用终端运行,但我想让它更容易通过我的桌面访问.
How do I run this script just by double clicking it? It can be run using the terminal but I want to make it more accessible through my desktop.
我只是想在 Windows 上模拟一个 *.bat 文件.Windows 上的 *.bat 文件包含一系列可在命令提示符下运行的脚本,只需双击即可执行.
I was just trying to mimic a *.bat file on windows. A *.bat file on windows contains series of scripts operable on command prompt and executable just by double clicking on it.
推荐答案
请按照以下步骤操作:
点击
Alt+F2
,输入dconf-editor
并点击Enter".
Hit
Alt+F2
, typedconf-editor
and hit ``Enter.
在 dconfg-editor 中转到:org ➤ gnome ➤ nautilus ➤ 首选项
In dconfg-editor goto: org ➤ gnome ➤ nautilus ➤ preferences
点击executable-text-activation
并从下拉菜单中选择:
Click on executable-text-activation
and from drop down menu select:
启动:将脚本作为程序启动.
launch: to launch scripts as programs.
或
询问:通过对话框询问要做什么.
ask: to ask what to do via a dialog.
关闭 dconf-editor
就是这样!
这篇关于如何通过双击在 Linux 上运行脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!