bug-ed
[Top][All Lists]
Advanced

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

Escaped percent sign in shell escape (bang) command (ed 1.16)


From: Martin Thomsen
Subject: Escaped percent sign in shell escape (bang) command (ed 1.16)
Date: Sat, 10 Jul 2021 21:43:17 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Hello,

Using GNU bash 5.0.17(1) and GNU ed version 1.16 the command

    printf '%s\n' 'r !date +"% modified on \%F"' ',p' Q | ed -s fil1

outputs

    date +"fil1 modified on \%F"
    fil1 modified on \2021-07-10

I think the output should contain no backslashes, per POSIX
documentation. The GNU ed manual would benefit from clarification.


POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed.html> says following about the Shell Escape Command: "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"

GNU ed manual - section `Commands, !COMMAND` - says:
"'ed' does not process COMMAND for backslash ('\') escapes. However,
an unescaped '%' is replaced by the default filename."


Regards,

M. Thomsen
DK-8000 Aarhus



reply via email to

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