X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:from:subject:date:message-id:references
	:mime-version:content-type:content-transfer-encoding; q=dns; s=
	default; b=KDCwvc7QURY9OhVLnpkDSKfDsIH6fmQuaWhxJPn1rXMKphB8plMax
	MSV60qB/bB2qTNbu4VkrAW3SiowtHRP2tDaeeYJru8z1SvRMFqLMT1dQwLKI+X17
	xod6DZcxbJy/IAebWYWfnQnSm2OoNFBprz0M67hKg0gIb8UJn4H1DI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:to:from:subject:date:message-id:references
	:mime-version:content-type:content-transfer-encoding; s=default;
	 bh=kKNVZFdUvmfBsDGh9mg5fQ6nNMQ=; b=M3+jHM2cIbCzWL2kdeLLMToI1mZw
	jmD4ZN/LtoafPno7WTIfA63TTHyAUrGEzkstxa7lzx+gEuaFN/4RsQvCG9YC/SxZ
	p7oZUYOtwWyqhttO2CD2R1wi7cDJpTKVZKEzsMEGG00lUPDaBgftgiQVQqa/DkNF
	58ZK7gdN+5eJG5o=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=2.5 required=5.0 tests=BAYES_60,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=H*UA:3.0.4, thorsten, H*u:3.0.4, scriptsh
X-HELO: blaine.gmane.org
To: cygwin@cygwin.com
From: Thorsten Kampe <thorsten@thorstenkampe.de>
Subject: Re: /dev/stderr problem
Date: Mon, 17 Oct 2016 08:32:20 +0200
Lines: 32
Message-ID: <nu1rav$te3$2@blaine.gmane.org>
References: <nu1qtk$te3$1@blaine.gmane.org>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
User-Agent: MicroPlanet-Gravity/3.0.4
X-IsSubscribed: yes

* 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

