【发布时间】:2021-06-08 03:41:38
【问题描述】:
我们可以使用echo $PS1查看
test@testauto:~$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\u@\h:\w\$
test@testauto:~$
但我想要的是 "test@testauto:~$" 而不是 "[\e]0;\u@\h: \w\a]${debian_chroot:+($debian_chroot)}\u@\h :\w$"
我怎样才能得到它?
【问题讨论】:
-
顺便说一句,我总是发现
"\[\e[38;5;244m\]\D{%R}\[\e[38;5;32m\] \h:\w> \[\e[0m\]"的用户提示和"\[\e[1;34m\][\[\e[38;5;203m\]\A \[\e[1;34m\]\h\[\e[38;5;197m\]:\w\[\e[1;34m\]] # \[\e[0m\]"的根提示很有帮助。 (256色xterm)除了提供时间之外,他们还提供了当前路径信息的形式,可以和rsync、scp等一起使用。00:48 wizard:~/tmpd>的用户提示和 root 提示(相同位置)[00:48 wizard:/home/david/tmpd] # -
@GavinHunte21 :您将问题标记为 shell,即 POSIX shell。请参阅 here 了解您可以在
PS1中添加的内容。我不清楚您的问题如何符合 POSIX shell 的概念。