From: Etaoin Shrdlu <shrdlu@unlimitedmail.org>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] 'if echo hello' in .bashrc
Date: Fri, 8 May 2009 17:13:41 +0200 [thread overview]
Message-ID: <200905081713.41413.shrdlu@unlimitedmail.org> (raw)
In-Reply-To: <200905081651.14777.alan.mckinnon@gmail.com>
On Friday 8 May 2009, 16:51, Alan McKinnon wrote:
> > > except that STDERR is combined with STDOUT and sent to /dev/null
> > > so the script will never get it, the if is always true and the
> > > entire check is redundant. Better would be
> > >
> > > if echo hello|grep --color=auto l >/dev/null ; then
> >
> > That will output an uncaptured error message if --color is not
> > supported.
>
> which is the desired effect. It causes the if to be false and the grep
> options are not enabled (as they are not supported)
It's not the fact that the error message is left free to show on screen
that makes the exit status true or false.
If the file is sourced from a non-interactive environment, you don't want
anything printed (and probably, in this case, neither if it's an
interactive session). Capturing stderr does not change the exit status
of the pipeline.
next prev parent reply other threads:[~2009-05-08 15:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-08 13:38 [gentoo-user] 'if echo hello' in .bashrc Stroller
2009-05-08 14:01 ` Mike Kazantsev
2009-05-08 14:09 ` Stroller
2009-05-08 14:10 ` Alan McKinnon
2009-05-08 14:38 ` Christian
2009-05-08 14:43 ` Alan McKinnon
2009-05-08 14:57 ` Eray Aslan
2009-05-08 14:59 ` Etaoin Shrdlu
2009-05-08 14:51 ` Alan McKinnon
2009-05-08 15:13 ` Etaoin Shrdlu [this message]
2009-05-08 16:22 ` Carlos Hendson
2009-05-08 18:08 ` James Rowe
2009-05-08 18:05 ` Mike Kazantsev
2009-05-09 10:15 ` Stroller
2009-05-09 10:41 ` Etaoin Shrdlu
2009-05-09 10:43 ` Stroller
2009-05-09 11:13 ` Etaoin Shrdlu
2009-05-09 14:38 ` Joerg Schilling
2009-05-09 11:38 ` Mike Kazantsev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200905081713.41413.shrdlu@unlimitedmail.org \
--to=shrdlu@unlimitedmail.org \
--cc=gentoo-user@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox