public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Marco Atzeri <marco.atzeri@gmail.com>
To: cygwin@cygwin.com
Subject: Re: Pipe after Command Substitution does not resolve the substitution:
Date: Wed, 14 Jun 2017 10:34:00 -0000	[thread overview]
Message-ID: <be374781-69bd-e226-33d6-7ca1426d02ce@gmail.com> (raw)
In-Reply-To: <CAMwBcu5zQkiSRJQp9sPM5_n=emNzskk9Nk4dfQfGGe7fgOFEQQ@mail.gmail.com>

On 14/06/2017 09:41, Jon Bord wrote:
> Hi,
>
> This is the first time i've ever submitted a bug report so i hope the
> below is ok. I am not a programmer although i do do some scripting.
>
> The below is the kind of 'command substitution then pipe' that i often
> used in Cygwin on Windows 7.  Now that i've been forced to move to
> Windows 10 it no longer seems to work. I'm assuming that this is not a
> feature of an upgraded Bash but maybe i'm wrong, eg maybe we are now
> supposed to put everything in variables rather than use command
> substitution.
>
> Windows 10
> bash 4.4.11(2) and 4.4.12(3)
>
> $ set -xv
>
> (EXAMPLE 1: COMMAND SUBSTITUTION WORKS AS EXPECTED)
> $ grep 2 $(ls | tail -1)
> grep 2 $(ls | tail -1)
> ++ ls
> ++ tail -1
> + grep 2 test.txt
> 2
> 23
>
> (EXAMPLE 2: HANGS)
> $ grep 2 $(ls | tail -1)  | grep 3
> grep 2 $(ls | tail -1)  | grep 3
> + grep 3
> + grep 2
>
> (EXAMPLE 3: HANGS)
> $ grep 2 `ls | tail -1` | grep 3
> grep 2 `ls | tail -1` | grep 3
> + grep 3
> + grep 2
>
> Would it be correct to conclude from the above output that once the
> pipe is added then it is ignoring the substitution?
>

Hi Jon,
all the examples work for me on W7 64 with cygwin 64bit.

  $ ls
prova.txt

$ cat prova.txt
1
2
3
23

$ grep 2 $(ls | tail -1)
2
23

$ grep 2 $(ls | tail -1)  | grep 3
23

$ grep 2 `ls | tail -1` | grep 3
23

can you provide your cygcheck.out  ?
Problem reports:       http://cygwin.com/problems.html



--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  reply	other threads:[~2017-06-14 10:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14  7:41 Jon Bord
2017-06-14 10:34 ` Marco Atzeri [this message]
2017-06-14 14:14 ` Brian Inglis
2017-06-14 14:27 Jon Bord
2017-06-14 15:30 Jon Bord

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=be374781-69bd-e226-33d6-7ca1426d02ce@gmail.com \
    --to=marco.atzeri@gmail.com \
    --cc=cygwin@cygwin.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).