原文地址:http://blog.csdn.net/shouldnotappearcalm/article/details/64904253
昨天在登陆云服务器时候报错。
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
后面发现是自己傻逼的把profile在windows上写了传上去的。
用/bin/cat -v /etc/profile看到很多^M,是因为Windows下的换行符的原因。
现在在linux下面删了就行,我用的第一种方法。
第一种方法(先yum install -y dos2unix):
cat -A filename 就可以看到windows下的断元字符 ^M
要去除他,最简单用下面的命令:
- 1
第二种方法:
- 1
注意:^M的输入方式是 Ctrl + v ,然后Ctrl + M
第三种方法:
vi filename
:1,$ s/^M//g
^M 输入方法: ctrl+V ,ctrl+M
第四种方法:
cat filename |tr -d ‘/r’ > newfile
^M 可用 /r 代替