Fixed the default opening mode of Shell scripts in Ubuntu.

Source: Internet
Author: User
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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.