[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Handling of Zero-Width escapes in PS1
From: |
Chet Ramey |
Subject: |
Re: Handling of Zero-Width escapes in PS1 |
Date: |
Mon, 13 May 2019 15:19:23 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
On 5/4/19 1:38 PM, benbe1987@gmx.net 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 chet@case.edu http://tiswww.cwru.edu/~chet/