This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Pipe after Command Substitution does not resolve the substitution:


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]