.sh file execution error: -bash: xxx: /bin/sh^M: bad interpreter: No such file or directory Workaround
LinuxLinux is a free-to-use and freely distributed Unix-like operating system, which is a multi-user, multi-tasking, multi-threaded and multi-CPU operating system based on POSIX and UNIX. It runs major UNIX tools, applications, and network protocols.
This article explains to you .sh file execution error: -bash: xxx: /bin/sh^M: bad interpreter: No such file or directory Solution, interested students refer to it. Error description:
#./bin/sh echo "test sh file"
An error is reported when executing ./test.sh file in Ubuntu terminal, prompting: -bash: xxx: /bin/sh^M: bad interpreter: No such file or directory At that time, I thought about it, impossible, how could there be no such path?
Open the file using the vim tool
:set ff
I found that the current document is in doc format fileformat = doc Cause analysis: It is estimated that it may be because of the dual system, the reason for editing and saving under Windows, after testing again, it was found that this is indeed the case. Workaround: 1. In the vim tool environment
:set ff = unix
2. Download a doc2unix tool to solve this problem. 3. Use the editing of the notepadd++ emeditor class to transcode, as shown in the figure below
|