|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
If the PROMPT_SUBST option is set, the prompt string is first subjected to parameter expansion, command substitution and arithmetic expansion. See 13. Expansion.
Certain escape sequences may be recognised in the prompt string.
If the PROMPT_BANG option is set, a `!' in the prompt is replaced by the current history event number. A literal `!' may then be represented as `!!'.
If the PROMPT_PERCENT option is set, certain escape sequences that start with `%' are expanded. Some escapes take an optional integer argument, which should appear between the `%' and the next character of the sequence. The following escape sequences are recognized:
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. The test character x may be any of the following:
The forms with `<' truncate at the left of the string, and the forms with `>' truncate at the right of the string. For example, if the current directory is `/home/pike', the prompt `%8<..<%/' will expand to `..e/pike'. In this string, the terminating character (`<', `>' or `]'), or in fact any character, may be quoted by a preceding `\'; note when using print -P, however, that this must be doubled as the string is also subject to standard print processing, in addition to any backslashes removed by a double quoted string: the worst case is therefore `print -P "%<\\\\<<..."'.
If the string is longer than the specified truncation length, it will appear in full, completely replacing the truncated string.
The part of the prompt string to be truncated runs to the end of the string, or to the end of the next enclosing group of the `%(' construct, or to the next truncation encountered at the same grouping level (i.e. truncations inside a `%(' are separate), which ever comes first. In particular, a truncation with argument zero (e.g. `%<<') marks the end of the range of the string to be truncated while turning off truncation from there on. For example, the prompt '%10<...<%~%<<%# ' will print a truncated representation of the current directory, followed by a `%' or `#', followed by a space. Without the `%<<', those two characters would be included in the string to be truncated.
|[ << ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|