On 5/4/19 1:38 PM, [email protected] wrote:
> Bash Version: 4.4
> Patch Level: 19
> Release Status: release
>
> Description:
> When setting up a complex PS1 prompt where parts of the
> prompt is expanded on every new prompt displayed by bash
> the escape sequences that are generated by that dynamic
> part are handled improperly (read: not at all).
>
> The desired behaviour should treat such escapes for e.g.
> the sequences \[ and \] equal both when the prompt expands
> to stuff\[stuff\]stuff, regardless of whether this was
> reached by "stuff$(echo \[stuff\])stuff" (\[\] handled) or
> reached by 'stuff$(echo \[stuff\])stuff' (not handled) being
> set as the value of PS1.
The PS1 escape sequences, including \[ and \], are processed before the
word expansions (which are optional). You could assemble the dynamic parts
of PS1 using multiple assignments with `eval' or use PROMPT_COMMAND as
Dennis suggested.
I don't have any plans to change the evaluation order.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/