When you double-click a script (. sh file), what do you want to do? The general idea is to execute it. However, this is not the case in Ubuntu, or I should say it is in Files (Nautilus. You may yell & ldquo; for running files, run files & rdquo;, but the files are not running but opened with Gedit. I know that you may say that the file has executable permissions? I will say yes. The script has the executable permission, but when I double-click it, it is opened in a text editor. I do not want
When you double-click a script (. sh file), what do you want to do? The general idea is to execute it. However, this is not the case in Ubuntu, or I should say it is in Files (Nautilus. You may yell "run file, run file", but the file is not running but opened with Gedit.
I know that you may say that the file has executable permissions? I will say yes. The script has the executable permission, but when I double-click it, it is opened in a text editor. I don't want this. If you encounter the same problem, I think you might want it too.
I know that you may have been recommended to execute it in the terminal. I know that this is feasible, but isn't it an excuse that it cannot run in the GUI?
In this tutorial, we will seeHow to run the shell script after double-clicking.
Fixed the problem of opening shell scripts in Ubuntu with a text editor.
The reason why shell scripts are opened in the file editor is the default behavior settings in Files (File Manager in Ubuntu. In earlier versions, it may ask if you want to run the file or open it in the editor. The default behavior is modified in the new version.
To fix this, go to the File Manager and clickOption:
Next, enter the Behavior label in the file options (Files Preferences). You will see the Executable Text Files option.
By default, it is set to "View executable text files when they are opend when opening )". I suggest you change it to "Ask every time", so you can choose whether to execute or edit it, of course, you can also select "Run executable text files when they are opend when opening )". You can choose one by yourself.
I hope this tip can help you solve this small "problem ". You are welcome to raise questions and suggestions.
For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2
Via: http://itsfoss.com/shell-script-opens-text-editor/
Author: Abhishek Translator: geekpi Proofreader: wxy
This article was originally translated by LCTT and launched with the Linux honor in China
This article permanently updates the link address: Http://www.linuxidc.com/Linux/2015-11/125403.htm