public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* /dev/stderr invalid with nested and chained redirections
@ 2017-07-10  7:18 cygwin-mailinglist
  2017-07-10  7:39 ` Marco Atzeri
  0 siblings, 1 reply; 2+ messages in thread
From: cygwin-mailinglist @ 2017-07-10  7:18 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-07-10  7:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-10  7:18 /dev/stderr invalid with nested and chained redirections cygwin-mailinglist
2017-07-10  7:39 ` Marco Atzeri

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).