Different distros are preconfigured for different user populations. On a desktop, you mainly just expect to see a simple prompt and maybe the current directory; for a server distro, it is useful for the prompt on each server to be different from every other server, so that you can tell at a glance where you are logged into (the admin typically logs into more than one server at the same time). Other than that, though, it's just a matter of taste, typically the taste of the Bash maintainer for your distro. Out of the box, the default prompt in Bash is just bash$ (where the dollar sign is replaced with a hash sign when you are logged in as root).
发布评论
评论(3)
这是一个品味问题:每个人都可以使用环境变量 PS1 配置他的 PROMPT 行。
例如:
给出
,而目录是您的主目录的“~”。
It's a question of taste: everyone can configure his PROMPT-line with the env-variable PS1.
For example:
gives
whereas directory is '~' for your home-dir.
看起来是这样的:
即使颜色很好。为什么?因为我的
~/.bashrc
包含 WithPS1
行,所以您可以完全控制提示符的外观。您可以通过
man bash
的PROMPTING
部分获取更多信息。Here it looks this way:
even with nice colors. Why? Because my
~/.bashrc
contains the lineWith
PS1
, you have full control over how your prompt looks like. You get more info withman bash
, sectionPROMPTING
.不同的发行版是针对不同的用户群体预先配置的。在桌面上,您主要只是期望看到一个简单的提示,也许还有当前目录;对于服务器发行版,每台服务器上的提示与其他服务器上的提示不同是很有用的,这样您一眼就能看出您登录的位置(管理员通常会同时登录多个服务器) 。但除此之外,这只是一个品味问题,通常是你的发行版的 Bash 维护者的品味。 Bash 中的默认提示符就是
bash$
(当您以 root 身份登录时,美元符号将替换为井号)。Different distros are preconfigured for different user populations. On a desktop, you mainly just expect to see a simple prompt and maybe the current directory; for a server distro, it is useful for the prompt on each server to be different from every other server, so that you can tell at a glance where you are logged into (the admin typically logs into more than one server at the same time). Other than that, though, it's just a matter of taste, typically the taste of the Bash maintainer for your distro. Out of the box, the default prompt in Bash is just
bash$
(where the dollar sign is replaced with a hash sign when you are logged in as root).