设置"%(!.%{%F{yellow}%}.)$USER@%m"里的(!.%{%F{yellow}%}.)
是什么意思啊
???
1
neoblackcap 2016-02-20 23:06:54 +08:00
感觉是一个字符串格式化的意思,应该是以某种格式,加字体颜色为黄色输出的意思。
|
2
hongfeiyu OP @neoblackcap 我猜是如果是 root 用户的话就显示闪电的标志。。。
|
3
wittyfox 2016-02-21 00:10:15 +08:00 via Android
来自官方 Manual 的解释
%(x.true-text.false-text) Specifies a ternary expression. The character following the x is arbitrary; the same character is used to separate the text for the ‘ true ’ result from that for the ‘ false ’ result. This separator may not appear in the true-text, except as part of a %-escape sequence. A ‘)’ may appear in the false-text as ‘%)’. true-text and false-text may both contain arbitrarily-nested escape sequences, including further ternary expressions. The left parenthesis may be preceded or followed by a positive integer n, which defaults to zero. A negative integer will be multiplied by -1, except as noted below for ‘ l ’. The test character x may be any of the following: ! True if the shell is running with privileges. 意思就是说,如果是 root 就用黄色。 |