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\]]\\$ "