This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: /dev/stderr problem
- From: Thorsten Kampe <thorsten at thorstenkampe dot de>
- To: cygwin at cygwin dot com
- Date: Mon, 17 Oct 2016 08:32:20 +0200
- Subject: Re: /dev/stderr problem
- Authentication-results: sourceware.org; auth=none
- References: <nu1qtk$te3$1@blaine.gmane.org>
* Thorsten Kampe (Mon, 17 Oct 2016 08:25:13 +0200)
> the following bash script results in a different output when
> redirected to a file.
>
> ```
> printf "FIRST LINE\n" > /dev/stderr
> shopt -os xtrace
> printf "SECOMD LINE\n" > /dev/stderr
> ```
On further inspection: the `xtrace` is not related to the problem:
script.sh
```
printf "FIRST LINE\n" > /dev/stderr
printf "SECOMD LINE\n" > /dev/stderr
```
```
$ bash script.sh
FIRST LINE
SECOMD LINE
$ bash script.sh 2> file && cat file
SECOMD LINE
$ file /dev/stderr
/dev/stderr: symbolic link to /proc/self/fd/2
```
Thorsten
--
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