Bash 在 $PS1 前面加上符號「@」。我該如何擺脫它?

Bash 在 $PS1 前面加上符號「@」。我該如何擺脫它?

我運行的是 Ubuntu 16.04,bash 總是在提示符號前面加上“@”,無論 .bashrc 中設定的值如何~/.bashrc

我嘗試~/.bashrc使用命令在文件中和終端內設定不同的值export

例如,這是我的終端的一部分:

@$ export PS1='HELLO '
@HELLO

我什至嘗試恢復到原來的~/.bashrc,但沒有成功,因為 @ 仍然存在於每一行。

  • 有辦法擺脫它嗎?
  • 我還應該查看另一個設定檔嗎?
  • 這是我應該報告的錯誤嗎?

答案1

您似乎已配置readline為啟用編輯模式指示。從8.3.1 Readline 初始化檔案語法Bash 參考手冊的內容:

show-mode-in-prompt (Off)
       If set to On, add a character to the  beginning  of  the  prompt
       indicating  the  editing  mode:  emacs (@), vi command (:) or vi
       insertion (+).

您應該能夠在目前 shell 中使用停用它

bind 'set show-mode-in-prompt off'

要永久停用它,您需要找到它的設定位置,可能是您的~/.inputrc/etc/inputrc檔案。

相關內容