Re: PS0 vs. \[ \]

Chet Ramey <[email protected]> Mon, 18 May 2026 10:39:23 -0400
Newsgroups gmane.comp.shells.bash.bugs
Organization ITS, Case Western Reserve University
Message-ID <[email protected]>
On 5/15/26 7:34 AM, Egmont Koblinger wrote:
> Hello,
> 
> The manual's PROMPTING section says that PS[0124] support a long list of
> escaped characters, including \[ and \].
> 
> Actually, in bash-5.3.9, PS0 does not support \[ and \]. If these are
> present in its value, their corresponding raw 0x01 and 0x02 bytes do get
> printed, rather than getting eliminated.

The \[ and \] escapes only matter to readline, so it's reasonable to ignore
them for PS0 and PS4 (though it makes no sense to include them in $PS4,
at least). Bash already ignores them when line editing isn't enabled.

Chet

-- 
``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/
OpenPGP_signature.asc (application/pgp-signature, 203 B)
-----BEGIN PGP SIGNATURE-----

wmMEABEIACMWIQR8ATX7CIqvbGbGULm7WGnwZOp0qwUCagskmwUDAAAAAAAKCRC7WGnwZOp0q1Sx
AKCQUI3unpzIxx3Zhb5zc/LwQ7ck6QCdFU7a23OL8ZbtbrTEKKuUezda9Qs=
=bsCM
-----END PGP SIGNATURE-----