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]

/dev/stderr invalid with nested and chained redirections


I have a script which does not find /dev/stderr when its stderr is
redirected and piped. The minimal reproduction follows below. This is a
verbatim copy from the terminal with edited-in comments prefixed with
hashes.

$ uname -a
CYGWIN_NT-6.1-WOW xxxxxxxx 2.8.1(0.312/5/3) 2017-07-03 14:06 i686 Cygwin
$ bash --version
GNU bash, version 4.4.12(3)-release (i686-pc-cygwin)
[...]
########################################################
$ cat say-something.sh
#!/bin/sh
echo something > /dev/stderr
########################################################

############### This is the error:
$ (x=$(./say-something.sh 2> /dev/stderr)) |& cat
./say-something.sh: line 2: /dev/stderr: No such file or directory

############### Variants without sub-shell, piping or redirection work:
$ (x=$(./say-something.sh 2> /dev/stderr)) | cat
something
$ (x=$(./say-something.sh 2> /dev/stderr))
something
$ x=$(./say-something.sh 2> /dev/stderr) |& cat
something
$ (x=$(./say-something.sh > /dev/stderr)) |& cat
something
$ (x=$(./say-something.sh 2> /dev/stdout)) |& cat
$


--
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]