什么是PS1和PROMPT_COMMAND之间的区别 [英] What is the difference between PS1 and PROMPT_COMMAND

查看:948
本文介绍了什么是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的文档页面:<一href=\"http://www.gnu.org/software/bash/manual/bashref.html\">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之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆