2026年5月18日(月) 17:22 Chet Ramey <[email protected]>:
> On 5/15/26 7:47 AM, Koichi Murase wrote:
> > I think ${var@P} should also remove \x01 and \x02 at the final step.
>
> This transformation is often used with the `read' builtin (read -p). One of
> the reasons I added it in 2014 was in response to requests to use the
> prompt expansions with read -p.

Thank you for the explanation. I haven't thought of that usage. If
that is the original motivation for the @P conversion, it makes sense
to preserve \x01 and \x02. I had other types of usage in mind, such as
Ref. [1], but the usage with `read -p' actually seems common [2].

[1] 
https://github.com/atuinsh/atuin/blob/b77b86bb7d0feb88224347b70cd234bea57d7608/crates/atuin/src/shell/atuin.bash#L130-L139
[2] 
https://github.com/search?q=%2F%28%3F-i%29read+.*-%5B%5E+%5D*p.*%5C%24%5C%7B.*%40P%5C%7D%2F&type=code

--
Koichi

Reply via email to