Linux|Script operation error (bad interpreter: no such file or directory) solution

Linux| Script running error (bad interpreter: no such file or directory)

UltraEditSublime TextLinuxNotepad ++ V-IM

Reason:
In Linux, sometimes when we copy scripts written under Windows to run in the Linux environment, it will not run.
Mainly, the newline character in Windows is \r\n, and the newline symbol in Linux environment is \ n.

Solution:
Use the UE text editing tool to replace all \r\n in the script file with \n.

Method 2:
When executing the script, an error message pops up:

/bin/sh^M: Damaged interpreter: There is no such file or directory.
1
This is caused by the use of DOS file format when saving the script file. You can open the file with vim, and then perform the following operations:

:set ff=unix
:wq

Editing scripts under windows often encounters various pits, so it is not recommended to edit script files under windows. If you use UltraEdit, the default file encoding format to open is simplified Chinese GBK, it is best to switch to utf8 format.
The setting method is as follows:
Advanced-Settings-File processing-DOS/Unix/Mac processing, just change the "default type of new file" to "UNIX".

Editing code under windows is a real pit, Android Studio is not in utf8 format and it has not been compiled, and it is not possible to switch the encoding format with Notepad++, causing the APK interface to be messy.
It is recommended to use Sublime Text under winodws. The code is more highlighted, the interface is simple, or UltraEdit is used, but remember: Use UltraEdit, be sure, be sure, be sure (the important thing is said three times), change the default file type of UltraEdit to "UNIX "

Guess you like

Origin blog.csdn.net/BIGmustang/article/details/108566950