Date:        Fri, 12 Jun 2026 19:41:35 +0200
    From:        Egmont Koblinger <[email protected]>
    Message-ID:  
<cagwczkjbhzko9npajzasnmx3nefisqpjzsj6sdzfukhlc+l...@mail.gmail.com>

  | The documentation says that \[ and \] mark printable vs. non-printable
  | characters in the prompt.  Regardless of PS0 vs. PS1, regardless of
  | readlne vs. noediting mode.  (Surely, \[ \] are necessary helpers for
  | the readline case, while unnecessary (but surely supposed to be
  | harmless, right?) for the noediting case.)

Yes, and in the cases they're not needed, they simply do nothing.

  | Only the implementation order (1) (2) (3) would match this.

No, the current one does, it just doesn't meet your objective of
using them to hide your trailing \ - if it weren't for that you wouldn't
even notice.

  | It's documented which quoted character does what.

Only for readline, and hence only when readline is being used to
output the prompt.

  | Not a single word about them behaving differently in PS0 vs. PS1,

And also not a single word about \[ inserting a \1 or \] a \2, you
have to be looking at readline doc to guess that is what is happening
under the covers.

The generated strings differ.   The behaviour doesn't, except in your
case, which now you have decided to require promptvars to be set (or
perhaps already did without realising it previously) there's a simple
solution to that as well, simply use ${_bs_} (or something) where
_bs_='\', instead of a literal \ and you're safe, a \ generated from a
variable expansion won't affect anything which follows, and nor to you
need to attempt to calculate how many \'s are needed because of \\->\
reductions.

This discussion has gone on long enough.   I'm done.

kre


Reply via email to