GNU bug report logs - #21919
tee enhancement

Previous Next

Package: coreutils;

Reported by: "Tim Shaw" <timshaw <at> mail.usa.com>

Date: Sat, 14 Nov 2015 16:09:01 UTC

Severity: normal

Tags: notabug

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 21919 <at> debbugs.gnu.org (full text, mbox):

From: isabella parakiss <izaberina <at> gmail.com>
To: Tim Shaw <timshaw <at> mail.usa.com>
Cc: 21919 <at> debbugs.gnu.org
Subject: Re: bug#21919: tee enhancement
Date: Mon, 16 Nov 2015 02:22:33 +0100
On 11/14/15, Tim Shaw <timshaw <at> mail.usa.com> wrote:
> If I am using stdout redirection of a shell block to capture some text I am
> generating, errors need to go to stderr, but it would also be good if they
> went into the generated output. For example
> for i in files*; do
>   if there_is_an_error; then
>     echo big long complicated error message goes here >&2
>     echo big long complicated error message goes here
>     continue
>   fi
>    stuff_producing_text_on_stdout
> done > file_i_am_creating
>
> I do not like duplicating code, such as the big long error message echo. So,
> I could create a temp file or a temp shell var to save the message, but that
> makes things more complicated than just duplicating the code, and also is
> just not my style for something transient like this.
>
> What I would like to do is add a parameter to tee, "-2", that copies to
> stderr in addition to stdout, just like "-" copies to stdout twice. So the
> code becomes
>     echo big long complicated error message goes here | tee -2
> Simple, eh?
>
> Where's the tee source? I know this would not be POSIX compliant, but it
> would work for me, and I hate having to rewrite everything from scratch for
> trivial stuff like this.

tee /dev/stderr

---
xoxo iza




This bug report was last modified 6 years and 270 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.