From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1M2RDm-0004lT-2z for garchives@archives.gentoo.org; Fri, 08 May 2009 14:38:42 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4D0DDE043A; Fri, 8 May 2009 14:38:40 +0000 (UTC) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by pigeon.gentoo.org (Postfix) with SMTP id BC2ACE043A for ; Fri, 8 May 2009 14:38:39 +0000 (UTC) Received: (qmail invoked by alias); 08 May 2009 14:38:38 -0000 Received: from tino.or.uni-bonn.de (EHLO [192.168.3.167]) [131.220.141.131] by mail.gmx.net (mp056) with SMTP; 08 May 2009 16:38:38 +0200 X-Authenticated: #8716076 X-Provags-ID: V01U2FsdGVkX18gVXQJJfcgSShVPUd7SIoivq8dQ4cmnsfTa5TNKx 7DrOmpQqrr1iVF From: Christian Organization: privat To: gentoo-user@lists.gentoo.org Subject: Re: [gentoo-user] 'if echo hello' in .bashrc Date: Fri, 8 May 2009 16:38:30 +0200 User-Agent: KMail/1.9.9 References: <742F0C43-196E-465B-9991-3DFF1C655803@stellar.eclipse.co.uk> <20090508200114.5edbc580@coercion> <200905081610.20300.alan.mckinnon@gmail.com> In-Reply-To: <200905081610.20300.alan.mckinnon@gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200905081638.30925.mcr76@gmx.net> X-Y-GMX-Trusted: 0 X-FuHaFi: 0.62 X-Archives-Salt: 665c69c0-b5b2-44a0-a250-1f7a68e69034 X-Archives-Hash: 7e963d181a25af254bf91134d7cfc96f Hi Alan, Am Freitag, 8. Mai 2009 schrieb Alan McKinnon: > > Some greps (like BSD one) might not support '--color' option, so "echo > > hello|grep --color=3Dauto l" will return error code, skipping if clause, > > and won't break grep operation by adding an unsupported option. is this really right? The result of if echo hello|grep --Acolor=3Dauto l >/dev/null 2>&1; then echo hallo; fi is nothing. So the if clause is false although I pieped STDERR to /dev/null. > 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=3Dauto l >/dev/null ; then grep writes to STDERR if an error is occured. The result of=20 if echo hello|grep --Acolor=3Dauto l >/dev/null ; then echo hallo; fi is: grep: Unbekannte Option =BB--Acolor=3Dauto=AB Aufruf: grep [OPTION]... MUSTER [DATEI]... =BBgrep --help=AB gibt Ihnen mehr Informationen. Best regard Christian