原因:家目錄缺少 .bash_profile 或 .bashrc,導致 PS1 環境變數未設定。
vi ~/.bash_profile (不存在則新建)。export PS1='[\u@\h \W]\$ '\u=用戶名,\h=主機名,\W=當前目錄 basename。source ~/.bash_profile。終端機提示符即變為熟悉的 user@host ~$ 格式。
補充:亦可編輯 ~/.bashrc,並確保 .bash_profile 中 source 了 .bashrc,以同時支援登入與非登入 Shell。