Hugues Moretto-Viry dixit:

>Your PS1 conversion was useful. I tried it but now it says above my PS1:
>"mksh: read-only:"

read-only what?

set -x might help.

>If I understand correctly, the bash syntax "\[\e[1;34m\]" is replaced in
>mksh by: "\a\e[1;34m\a".

Not exactly…

>About blackslash expansions (\r, \a and \1), it's like bash or not (as
>described in the link[1])?

I think that link actually describes precisely what mksh implements
(but would have to look; \U is limited to the BMP and thus pointless
though), but…

… \a doesn’t substitute \[ and \] in GNU bash, it’s more like this:
the prompt is wrapped in $'…' (not just '…') so the shell doesn’t
even *see* those escapes when interpolating PS1. But the presence
of \r as the *second* octet in $PS1 makes the *first* octet (here,
I used \a for readability/easiness) the “flip-flop visibility”
character. (This hack was in the original AT&T ksh88, actually.)

So basically, whenever the shell sees \r as *second* char in PS1,
it takes note of the *first* one, and then uses the *third* one
and forward as prompt, toggling counting of (multibyte) character
widths on/off whenever the char noted earlier occurs, with the
stream defaulting to on (counted for prompt length). In mksh, since
a few versions, the “toggle” character is not printed, either.

>Thank you for taking time to reply till now. Gratitude.

You’re welcome!

bye,
//mirabilos
-- 
Support mksh as /bin/sh and RoQA dash NOW!
‣ src:bash (259 (278) bugs: 0 RC, 180 (194) I&N, 79 (84) M&W, 0 (0) F&P)
‣ src:dash (84 (98) bugs: 3 RC, 39 (43) I&N, 42 (52) M&W, 0 F&P)
‣ src:mksh (1 bug: 0 RC, 0 I&N, 1 M&W, 0 F&P, 1 gift)
http://qa.debian.org/data/bts/graphs/d/dash.png is pretty red, innit?

Reply via email to