delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/10/17/02:34:25

X-Recipient: archive-cygwin AT delorie DOT 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 AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT 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 AT cygwin DOT com
From: Thorsten Kampe <thorsten AT thorstenkampe DOT 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 AT blaine DOT gmane DOT org>
Mime-Version: 1.0
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019