本文介绍了什么是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中设置的提示时。两者有什么区别?一个SO搜索甚至有点更广泛的谷歌搜索中没有得到我的结果,因此,即使对地方的链接来寻找答案会是AP preciated。谢谢!

(and some use both) when setting the prompt in a bash shell. What is the difference between the two? An SO 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. Thanks!

推荐答案

从GNU Bash的文档页面:http://www.gnu.org/software/bash/manual/bashref.html

From the GNU Bash doc page: http://www.gnu.org/software/bash/manual/bashref.html

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之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 07:40