When developing, copy the script under windows to the linux file, and an error is reported when executed:
-bash: ./package.sh: /bin/sh^M: bad interpreter: No such file or directory
Obviously see "^M" appearing at the end of the line,
The solution is to use the "dos2unix" command to convert, the execution will not cause problems
dos2unix package.sh
通过命令git diff查看修改,出现^M换行问题,如图:
Solution (Pro test this is easy to use):
1 |
|
Problems with line breaks:
Converted to LF when submitted, not converted when checked out
git config --global core.autocrlf input