Antonio,

>> In any way, a proper escaping mechanism is really needed here,
>
> Then why POSIX does not require it?

I have no idea. The phrasing in the manpage is not the clearest:

    The remainder of the line after the '!'  shall be sent to the
    command interpreter to be interpreted as a shell command line.
    Within the text of that shell command line, the unescaped
    character '%' shall be replaced with the remembered pathname

-- 
https://www.man7.org/linux/man-pages/man1/ed.1p.html#EXTENDED_DESCRIPTION:~:text=by%20this%20command%2E-,Shell%20Escape%20Command,-Synopsis:

Which can be interpreted either way, but the principle of least surprise
suggests that re-interpreting remembered pathname as something that
isn’t the remembered pathname—is not really intuitive and predictable.

> BTW, I tried something similar. It didn't work[1].
>
> [1] http://lists.gnu.org/archive/html/bug-ed/2025-11/msg00000.html

What exactly didn’t work? The linked thread comes to the same
conclusion—file name escaping is useful. Am I reading it wrong?

Can you reproduce my recipe? I tried on 1.22.1 that Debian ships, and on
1.22.6 from GNU “FTP.” Both reproduce.

Best of luck,
-- 
Artyom Bologov
https://aartaka.me

Reply via email to