shell script error: -bash: / bin / sh ^ M: bad interpreter:

Today, I write a shell script, then an error in the implementation of, the following screenshot:

shell script error: -bash: / bin / sh ^ M: bad interpreter:

The main reason is the shell file in my windows edit and then upload it to linux system execution. Shell for dos format file format. The linux unix format can only be performed in the format of the script.

We can see the format format files through the vi editor. Proceed as follows:

1. First, open the file with the command vim

2. Use the vi command mode: set ff command

shell script error: -bash: / bin / sh ^ M: bad interpreter:

You can see the change file format dos:

shell script error: -bash: / bin / sh ^ M: bad interpreter:

3. Modify the file format is unix, use vi modify the file format, the command: set ff = unix

shell script error: -bash: / bin / sh ^ M: bad interpreter:

After their execution by viewing the file format set ff command, as follows:

shell script error: -bash: / bin / sh ^ M: bad interpreter:

Guess you like

Origin blog.51cto.com/1345992/2432985