linux显示-bash-4.2# 问题

  今天,安装配置完mysql后,重新连接的shell的时候显示的不是root@localhost # 了,而是显示的-bash-4.2# 

提示信息:

Last login: Tue Apr 5 00:38:57 2016 from 119.255.38.138
-bash: /root/.bash_profile: line 15: syntax error: unexpected end of file
-bash-4.2# /root/.bash_profile: line 15: syntax error: unexpected end of file
-bash: /root/.bash_profile:: No such file or directory

肯定是配置mysql的环境变量的时候出现了什么错误

网络上的额解决方法是:在终端里输入:
  PS1="[root@localhost ~]"

但是输入后,每次编辑都是显示root@localhost~,例如:进入/usr文件夹后,原来应该显示的是root@localhost usr:#但是现在人就显示的是root@localhost~。可见这个解决方法不是很正确。

原文地址:https://www.cnblogs.com/mxh1099/p/5354672.html