dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bosco <jbosco.gg@gmail.com>
To: Eric Blake <eblake@redhat.com>, dash@vger.kernel.org
Subject: Re: echo "\\1"?
Date: Thu, 27 Jul 2017 13:13:06 +0000	[thread overview]
Message-ID: <CAC4gepdsPNvUJyW4Zwto9wZGc1Naq5kMsnz+RdCyAurEZzGLZw@mail.gmail.com> (raw)
In-Reply-To: <7253a908-22d2-03e3-5493-418ca31e5590@redhat.com>

On 27 July 2017 at 12:54, Eric Blake <eblake@redhat.com> 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:

And because of this, I got an error compiling zziplib, you may see

>> 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"


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.

  reply	other threads:[~2017-07-27 13:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-27 12:23 Bosco
2017-07-27 12:54 ` Eric Blake
2017-07-27 13:13   ` Bosco [this message]
2017-07-27 14:24     ` Eric Blake
2017-07-27 14:44       ` Bosco
2017-07-27 14:51         ` Eric Blake
2017-07-27 15:10           ` Bosco
2017-07-27 15:19             ` Eric Blake
2017-07-27 15:32             ` Bosco
2017-07-27 17:26       ` Harald van Dijk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAC4gepdsPNvUJyW4Zwto9wZGc1Naq5kMsnz+RdCyAurEZzGLZw@mail.gmail.com \
    --to=jbosco.gg@gmail.com \
    --cc=dash@vger.kernel.org \
    --cc=eblake@redhat.com \
    --subject='Re: echo "\\1"?' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).