public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Jon Bord <namebookcoverjudge@gmail.com>
To: cygwin@cygwin.com
Subject: Pipe after Command Substitution does not resolve the substitution:
Date: Wed, 14 Jun 2017 07:41:00 -0000	[thread overview]
Message-ID: <CAMwBcu5zQkiSRJQp9sPM5_n=emNzskk9Nk4dfQfGGe7fgOFEQQ@mail.gmail.com> (raw)

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?

SPECULATION: i had wondered if the cause was a change in version of
bash but i cannot be sure what the version was that i was using on
Windows 7. I wish i had a record. I've tried this on both 4.4.11(2)
and 4.4.12(3). My instincts are that it is not, that it is Cygwin (or
more precisely bash.exe?) on Windows 10 instead. I have noticed other
differences / problems, eg arrow keys behaving oddly in vi, and
general sluggishness (but not tested yet).

Many thanks for any help and i hope this can contribute to keeping
Cygwin strong.

--
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  7:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14  7:41 Jon Bord [this message]
2017-06-14 10:34 ` Marco Atzeri
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='CAMwBcu5zQkiSRJQp9sPM5_n=emNzskk9Nk4dfQfGGe7fgOFEQQ@mail.gmail.com' \
    --to=namebookcoverjudge@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).