系统教程
您现在的位置是:首页>服务器系统>Linux系统内容

Linux登录报/etc/profile: line 11: syntax error near

时间:2018-05-11 出处:未知复制分享人气(次) 【

同事反馈他在一测试服务器(CentOS Linux release 7.2.1511)上修改了/etc/profile文件后,使用source命令不能生效,让我帮忙看看,结果使用SecureCRT一登录就发现下面错误信息:
Last login: Fri from 10.20.34.14
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: $'\r': command not found
-bash: /etc/profile: line 11: syntax error near unexpected token `$'{\r''
'bash: /etc/profile: line 11: `pathmunge () {
Linux登录报/etc/profile: line 11: syntax error near
 
错误提示信息已经反馈/etc/profile里面有一些异常,初步检查/et/profile文件后,没有发现异常,很是奇怪,后面我使用cat -v /etc/profile检查,发现里面大量的Windows下的换行符。如下截图所示:
Linux登录报/etc/profile: line 11: syntax error near
 
咨询了一下他是怎么修改,他反馈是将该文件拷贝出来,然后用文本编辑器修改,然后覆盖原文件。到这里已经知道具体原因了,使用dos2unix profile将profile文件从Windows格式文件转换为Unix、Linux格式,然后在执行source profile使之生效,问题解决。 
    最新资讯
    热门内容
    小米移动电源能为iPad mini充几次电