Bash

bash 不顯示提示(提示缺失)

  • January 6, 2022

從機器註銷後,我的伺服器不顯示標準 bash 提示符。

如果我 ssh 到這台伺服器,我可以在那裡進行所有操作(例如 ls、cwd 等) 嘗試重新安裝 bash(sudo apt-get install –reinstall bash)也沒有幫助,以及獲取 bashrc。

這是我目前在 ssh 之後的輸出:

Linux mymachine 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u6 (2018-10-08) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
source ~/.bashrc
ls
cd /tmp/
ls
192525856
250675275
873713638

(那裡沒有顯示提示,但我可以在那裡鍵入任何 linux 命令並直接顯示)。

我怎樣才能再次顯示 bash 提示?

編輯:使用此命令,我的 bash 提示符又回來了

bash -i
bash: cannot set terminal process group (4896): Inappropriate ioctl for device
bash: no job control in this shell
mymachine@myuser2:~$ ls

現在我試圖找出上面的錯誤,以及為什麼儘管有錯誤它仍會返回提示。

好的,我發現了問題, /dev/pts 由於某種原因失去了。安裝完所有東西後,它按預期工作:

mount -t devtmpfs -o mode=0755 udev /dev
mount: udev is already mounted or /dev busy
      udev is already mounted on /dev
      udev is already mounted on /opt/axess_310_TICKET/dev
      udev is already mounted on /opt/grafana_test/dev
      udev is already mounted on /opt/axess_39/dev
      udev is already mounted on /opt/axess_39_TICKET/dev
      udev is already mounted on /opt/ACS_DUMP_TEST/dev

mount -t devpts devpts /dev/pts
udevadm trigger

引用自:https://serverfault.com/questions/951087