wittyfox
2016-02-21 00:10:15 +08:00
来自官方 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 就用黄色。