If there is a possibility of a "^m" symbol in the end of a shell script that uses Windows editing
Because MS-DOS and windows are carriage return + line wrapping, so in Linux with Vim to see the code written in Windows VC, after the end of the "^m" symbol, the expression is a character.
In Vim to solve this problem, it is very simple, in vim with the substitution function can kill "^m", type the following replacement command line:
1) vi-b setup.sh
2 in the command edit line < is: Press Esc key then shift+: colon > Input:%s/^m//g
Note: the "^m" character in the above command line is not "^" plus "M", but is generated by the "Ctrl + V" and "ctrl+m" keys.
After this is replaced, the save can be executed.
Of course, there are other ways to replace them, such as:
A. Some Linux versions have Dos2unix programs that can be used to eliminate ^m.
B.cat filename1 | Tr-d "/R" > NewFile remove ^m to generate a new file, as well as the SED command, which can be replaced by the command can be used to new into a file.