From owner-freebsd-chat@FreeBSD.ORG Sat Jul 18 00:38:43 2009 Return-Path: Delivered-To: chat@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5D23106564A for ; Sat, 18 Jul 2009 00:38:43 +0000 (UTC) (envelope-from aw1@stade.co.uk) Received: from v-smtp-auth-relay-1.gradwell.net (v-smtp-auth-relay-1.gradwell.net [79.135.125.40]) by mx1.freebsd.org (Postfix) with ESMTP id 1FB808FC14 for ; Sat, 18 Jul 2009 00:38:42 +0000 (UTC) (envelope-from aw1@stade.co.uk) Received: from 93-97-22-18.zone5.bethere.co.uk ([93.97.22.18] helo=access2.hanley.stade.co.uk) by v-smtp-auth-relay-1.gradwell.net with esmtp (Gradwell gwh-smtpd 1.290) id 4a6110cd.1bbf.7 for chat@freebsd.org; Sat, 18 Jul 2009 01:01:17 +0100 (envelope-sender ) Received: from steerpike.hanley.stade.co.uk (steerpike [192.168.1.10]) by access2.hanley.stade.co.uk (8.14.1/8.14.1) with ESMTP id n6I01G9G014765 for ; Sat, 18 Jul 2009 01:01:16 +0100 (BST) (envelope-from aw1@steerpike.hanley.stade.co.uk) Received: from steerpike.hanley.stade.co.uk (localhost [127.0.0.1]) by steerpike.hanley.stade.co.uk (8.14.3/8.14.3) with ESMTP id n6I01Ggg008740 for ; Sat, 18 Jul 2009 01:01:16 +0100 (BST) (envelope-from aw1@steerpike.hanley.stade.co.uk) Received: (from aw1@localhost) by steerpike.hanley.stade.co.uk (8.14.3/8.14.3/Submit) id n6I01Ght008739 for chat@freebsd.org; Sat, 18 Jul 2009 01:01:16 +0100 (BST) (envelope-from aw1) Date: Sat, 18 Jul 2009 01:01:16 +0100 From: Adrian Wontroba To: chat@freebsd.org Message-ID: <20090718000116.GA8379@steerpike.hanley.stade.co.uk> Mail-Followup-To: Adrian Wontroba , chat@freebsd.org References: <200907172257.QAA15292@lariat.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200907172257.QAA15292@lariat.net> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-PRERELEASE Organization: Oh dear, I've joined one again. X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on steerpike.hanley.stade.co.uk X-Virus-Status: Clean Cc: Subject: Re: Bourne shell short-circuit operators improperly documented X-BeenThere: freebsd-chat@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: aw1@stade.co.uk List-Id: Non technical items related to the community List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 18 Jul 2009 00:38:43 -0000 On Fri, Jul 17, 2009 at 04:57:12PM -0600, Brett Glass wrote: > Short-Circuit List Operators > ``&&'' and ``||'' are AND-OR list operators. ``&&'' executes the first > command, and then executes the second command if the exit status of the > first command is zero. ``||'' is similar, but executes the second com- > mand if the exit status of the first command is nonzero. ``&&'' and > ``||'' both have the same priority. > > This is exactly backward. No it is succinctly correct but confusing (the UNIX way?). These operators work on exit codes where 0 = success = true and and !0 = failure = false. [aw1@steerpike ~]$ sh $ true && echo true true $ false || echo false false $ true; echo $? 0 $ false; echo $? 1 $ exit -- Adrian Wontroba Confused? You will be. Just watch ...