Home  >  Article  >  Development Tools  >  How to solve the problem that the shell script written in Notepad++ cannot be executed under Linux

How to solve the problem that the shell script written in Notepad++ cannot be executed under Linux

(*-*)浩
(*-*)浩Original
2019-11-23 11:21:125442browse

How to solve the problem that the shell script written in Notepad++ cannot be executed under Linux

Notepad is a free and open source code editor under Windows environment. Supported languages: C, C, Java, C#, XML, HTML, PHP, Javascript!

This article will explain to you the solution to the problem that the shell script developed under Windows using notepad cannot be executed when uploaded to Linux (bom problem). Interested students can refer to it. (Recommended learning: notepad )

Problem description:

During a debugging shell statement, it was discovered that the shell copied from the notepad text When executed on Linux, there are no errors! But when uploading the shell script written in notepad to the Linux system for debugging, an error that the command cannot be found is reported! After thinking about it, the root cause of the problem must be on Nodepad. After searching for the reason, it turned out to be a problem with format conversion

1. View the current text format

In the Notepad interface, in There is a description of the file format in the lower right corner: "Dos\Windows or UNIX or Mac".

How to solve the problem that the shell script written in Notepad++ cannot be executed under Linux

#2. File conversion method

But if you need to convert like this every time you write a shell file, it may be very troublesome, then there is Is there no permanent solution?

The answer is yes, we can set Notepad to create new files in shell format by default. The specific operations are as follows:

Open in notepad, settings, first Options

How to solve the problem that the shell script written in Notepad++ cannot be executed under Linux

Note:

1 File format, line breaks are different between windows and linux

2 Do not have BOM header in utf8 files

The above is the detailed content of How to solve the problem that the shell script written in Notepad++ cannot be executed under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn