標籤:-bash-4.1#
CentOS下shell顯示-bash-4.1$不顯示使用者名稱路徑的解決方案
問題描述:
CentOS下新增一個使用者,登入進去之後shell指令碼的資訊如下:
650) this.width=650;" src="http://up.2cto.com/2013/0605/20130605091807247.jpeg" style="border-width:0px;padding:0px;margin:0px;list-style:none;width:118px;height:46px;" alt="20130605091807247.jpeg" />
而不是我們經常看到的[email protected]的組合,看起來很不舒服。
原因就是你建立使用者的時候,如果指定了-M參數,而因此沒有建立使用者家目錄,所以系統就不會在建立使用者的時候,自動拷貝/etc/skel目錄下的使用者環境變數檔案到使用者家目錄,也就導致這些檔案不存在,出現-bash-4.1#的問題了,手動拷貝一下就行
解決方案一、未驗證
[[email protected] 3307]# ls -a /etc/skel/
. .. .bash_logout .bash_profile .bashrc
直接cp -a /etc/skel/* 到家目錄下就可以了
解決方案二、已驗證,此方法有效
-bash-4.1#
上面這是解決之前的狀態
方法如下:
1.在Terminal輸入:
[plain]
vi ~/.bash_profile
2.如果沒有.bash_profile可以自己添加。然後往檔案中添加如下內容:
[plain]
export PS1=’[\[email protected]\h \W]\$’
注意‘是英文狀態下的字元。
3.輸入以下指令,使更改生效:
[plain]
source ~/.bash_profile
這樣,shell開始就會顯示的是我們熟悉的[email protected]的格式了,如下顯示正常:
[[email protected]_back ~]#
本文出自 “蘭州linux營運” 部落格,請務必保留此出處http://linuxzkq.blog.51cto.com/9379412/1662520
CentOS下shell顯示-bash-4.1#不顯示使用者名稱路徑的解決方案