错误总结

1.由于添加到profile中的内容,出现的语法错误,比如:少个单引号,或单引号,或中括号等。这叫不成对。如下:

[root@junnan1 ~]# source /etc/profile
-bash: /etc/profile: line 79: unexpected EOF while looking for matching `"'
-bash: /etc/profile: line 81: syntax error: unexpected end of file
[root@junnan1 ~]#

原因如下:在profile文件中PS1="[中的双引号没有导致的。

79   PS1=[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\
    ]]\\$ "
 80

正确是这样的:

79   PS1="[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m
    \]]\\$ 

2. 在/etc/profie中误添加内容导致提示命令找不到,如下:

[root@junnan1 ~]# source /etc/profile
-bash: rt: command not found

原因如下:在profile中添加变量内容时,在行首多添加了tr,导致在执行source /etc/profile,提示-bash: rt: command not found。

 78 rt PS1="[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0
    m\]]\\$ "
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容