PS1 和 PROMPT_COMMAND 有什么区别? [英] What is the difference between PS1 and PROMPT_COMMAND?
本文介绍了PS1 和 PROMPT_COMMAND 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
同时查看 这个很棒的线程 我注意到有些例子使用了
While taking a look at this awesome thread I noticed that some examples use
PS1="Blah Blah Blah"
还有一些用途
PROMPT_COMMAND="Blah Blah Blah"
(有些人同时使用)在 Bash shell 中设置提示时.两者有什么区别?Stack Overflow 搜索,甚至更广泛的 Google 搜索都没有得到我的结果,因此即使是指向正确位置的链接来寻找答案也将不胜感激.
(and some use both) when setting the prompt in a Bash shell. What is the difference between the two? A Stack Overflow search and even a bit of broader Google searching aren't getting me results, so even a link to the right place to look for the answer would be appreciated.
推荐答案
来自 GNU Bash 文档页面 (Bash 参考手册):
From the GNU Bash documentation page (Bash Reference Manual):
PROMPT_COMMAND
If set, the value is interpreted as a command to execute before
the printing of each primary prompt ($PS1).
我从来没有用过它,但是当我只有 sh 时我可以使用它.
I never used it, but I could have used this back when I only had sh.
这篇关于PS1 和 PROMPT_COMMAND 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文