dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bosco <jbosco.gg@gmail.com>
To: Eric Blake <eblake@redhat.com>
Cc: dash@vger.kernel.org
Subject: Re: echo "\\1"?
Date: Thu, 27 Jul 2017 15:10:22 +0000	[thread overview]
Message-ID: <CAC4gepdMmWSdheZbfw44fn3eexJ4Wg3gSkj7pMChLNodB3UyTw@mail.gmail.com> (raw)
In-Reply-To: <bf53bb8a-a967-023f-a83b-c0245702c1a4@redhat.com>

That script of zziplib isn't mine, I only had to compile it once
because it was necessary for compile other program (TeX Live).

I'm not talking about POSIX, and I don't mind what it said. I'm
talking about the man page of dash, that said:

>  echo [-n] args...
>            Print the arguments on the standard output, separated by spaces.
>            Unless the -n  option is present, a newline is output following the
>            arguments.
>

According to

>            If any of the following sequences of characters is encountered
>            during output, the sequence is not output.  Instead, the specified
>            action is performed:

when \\ is reached is replaced by \.

>
>            \b      A backspace character is output.
>
>            \c      Subsequent output is suppressed.  This is normally used at
>                    the end of the last argument to suppress the trailing
>                    newline that e ec ch ho o would otherwise output.
>
>            \f      Output a form feed.
>
>            \n      Output a newline character.
>
>            \r      Output a carriage return.
>
>            \t      Output a (horizontal) tab character.
>
>            \v      Output a vertical tab.
>
>            \0digits
>                    Output the character whose value is given by zero to three
>                    octal digits.  If there are zero digits, a nul character
>                    is output.
>
>            \\      Output a backslash.
>
>            All other backslash sequences elicit undefined behaviour.
>

Then, in the command
  echo \\\\
because \\ is reached first, then it will be replaced by '\'
character, immediately after that another \\ is reached, then it will
be replaced by another '\' character. It turns out the ouput '\\'.

Bosco.

  reply	other threads:[~2017-07-27 15:10 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
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 [this message]
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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

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

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* 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).