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]

Re: /dev/stderr problem


* 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


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