bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PS0 vs. \[ \]


From: Koichi Murase
Subject: Re: PS0 vs. \[ \]
Date: Fri, 15 May 2026 20:47:44 +0900

2026年5月15日(金) 20:35 Egmont Koblinger <egmont@gmail.com>:
> 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 statement that "PS0 does not support \[\]" may be controversial
[^1], but I agree that it is reasonable to remove \x01 and \x02 at the
final step of printing PS0.

I think ${var@P} should also remove \x01 and \x02 at the final step.

[^1]: PS0 does support \[\] somehow by converting them to Bash's
internal markers \0x01 and \x02, but the behavior is incomplete and
undesired. In the case of PS[124], Bash or Readline finally removes
those markers before printing the prompt to the terminal. However,
Bash directly outputs PS0 to the terminal without removing \x01 and
\x02. In this sense, the support is incomplete.

--
Koichi



reply via email to

[Prev in Thread] Current Thread [Next in Thread]