Skip to content

Instantly share code, notes, and snippets.

@baijian
Last active December 23, 2015 15:29
Show Gist options
  • Select an option

  • Save baijian/6656049 to your computer and use it in GitHub Desktop.

Select an option

Save baijian/6656049 to your computer and use it in GitHub Desktop.
vim下查看文件编码
:set fileencoding
修改文件编码为utf-8
:set fileencoding=utf-8
unix2dos 是把linux文件格式转换成windows文件格式
dos2unix 是把windows格式转换成linux文件格式
To fix, open your script with vi or vim and enter in vi command mode (key ESC), then type this:
:set fileformat=unix
sed -i 's/\r//' filename
cat file_name.sh | tr -d '\r' > file_name.sh.new
If you're on OS X, you can change line endings in XCode by opening the file and selecting the
View -> Text -> Line Endings -> Unix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment