Re: echo "\\1"?

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

 



On 27 July 2017 at 12:54, Eric Blake <eblake@xxxxxxxxxx> wrote:
> Which man pages?  Echo is one of those programs that varies widely, and
> you are MUCH better off using printf(1) instead of echo(1) if you are
> trying to get newline suppression, trying to print something that might
> begin with -, or trying to print something that might contain \.

Sorry, maybe I did't explain it correctly, I mean the man pages of the
dash source:
https://git.kernel.org/pub/scm/utils/dash/dash.git/tree/src/dash.1#n1202

And because of this, I got an error compiling zziplib, you may see
https://github.com/gdraheim/zziplib/blob/v0.13.67/configure#L17542

>
>> for echo command, "\\" should print '\'
>> character, and \0digits should print the byte in octal base.
>> But the command
>>
>> echo "\\1"
>
> This is the same as
> echo '\1'
>
> which is NOT defined by POSIX as being a valid escape sequence that echo
> must recognize.
>
> (Did you mean to test
> echo '\\1'
> instead?)
>

I refer the following commands

echo "\\1"

or

echo \\1



> Here's the POSIX list of required escape sequences:
>
> http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html
>

There, it says the same as the man page of dash.

I understand that \\ is converted to '\' character.

> Arguably, since it is not required by POSIX, we don't have to do it. But
> I also can't argue that POSIX forbids us to support \1 as an extension
> (it says nothing about whether implementations can have additional
> escape sequences).  So I'll argue that it is intentional as a dash
> extension.  But if you can make dash smaller by getting rid of the
> extension, that might be an acceptable patch.

In that case, I think, the man page of dash should be modified with
that extension.

Thank you.
Bosco.
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux