I'm trying to capture the output of a command substitution. This works until a pipe is added to the command. Am I doing something wrong or is this a quirk of mingw?

$ bash --version
GNU bash, version 4.3.46(2)-release (x86_64-pc-msys)
$ echo $(ls | wc -l)
$ test=$(ls | wc -l); echo test="$test"

This looks like a quirk of mingw:

$ test=$(ls | wc -l); echo test="$test"
$ bash --version
GNU bash, version 4.3.43(1)-release (x86_64-redhat-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
| improve this answer | |
  • Yeah... just noticed it is creating a stackdump. :/ – Donald Byrd Jun 19 '17 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.