From owner-freebsd-stable Wed Aug 7 4:16:30 2002 Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EE39337B400 for ; Wed, 7 Aug 2002 04:16:27 -0700 (PDT) Received: from maild.telia.com (maild.telia.com [194.22.190.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id A982B43E9E for ; Wed, 7 Aug 2002 04:16:26 -0700 (PDT) (envelope-from erikt@midgard.homeip.net) Received: from d1o913.telia.com (d1o913.telia.com [195.252.44.241]) by maild.telia.com (8.12.5/8.12.5) with ESMTP id g77BGLvX014444 for ; Wed, 7 Aug 2002 13:16:22 +0200 (CEST) X-Original-Recipient: Received: from falcon.midgard.homeip.net (h62n2fls20o913.telia.com [212.181.163.62]) by d1o913.telia.com (8.8.8/8.8.8) with SMTP id NAA26004 for ; Wed, 7 Aug 2002 13:16:20 +0200 (CEST) Received: (qmail 64960 invoked by uid 1001); 7 Aug 2002 11:16:17 -0000 Date: Wed, 7 Aug 2002 13:16:17 +0200 From: Erik Trulsson To: Gavin Atkinson Cc: The Anarcat , "C.J." , freebsd-stable@FreeBSD.ORG, tjr@FreeBSD.ORG Subject: Re: /bin/sh changed? Message-ID: <20020807111616.GA64887@falcon.midgard.homeip.net> Mail-Followup-To: Gavin Atkinson , The Anarcat , "C.J." , freebsd-stable@FreeBSD.ORG, tjr@FreeBSD.ORG References: <20020806230018.GC1019@lenny.anarcat.ath.cx> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.1i Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, Aug 07, 2002 at 10:40:47AM +0100, Gavin Atkinson wrote: > On Tue, 6 Aug 2002, The Anarcat wrote: > > > Note that the mysql script is quite odd, in itself. It comes back to: > > > > sh -c 'true & && echo foo' > > > > which is quite foolish anyways. > > I don't see what the problem with this is, and am of the opinion that if > this particular construct does not work, it should. (Note i'm not talking > about the obviously wrong "||exit 1" following a line which does not end > with a backslash). > > Surely, the construct "foo & && echo foo" should be allowable, and should > mean "run foo in the background, and if successfull, say so". If foo is > not found, or not executable, or if the shell couldn't fork due to low > memory, then don't print that it was successful. This is what I have used > it for in the past. It don't think it worked for that anyway. Try running "sh -c '/nosuchfile & && echo foo'" (with a /bin/sh from before this change.) I think it will print "foo" even if /nosuchfile doesn't exist. (I have updated all my FreeBSD systems so I can't test it there, but that's the way it works on NetBSD which I believe has the same shell as FreeBSD.) The construction "cmd1 && cmd2" is supposed to run cmd2 iff the exit status of cmd1 is 0. When you do cmd1 & && cmd2 the exit status of cmd1 is unknown and therefore && is fairly meaningless. It can also be noted that zsh, bash and the Solaris /bin/sh all disallow the "cmd1 & && cmd2" construction which suggests that it shouldn't have been accepted by /bin/sh on FreeBSD in the first place. -- Erik Trulsson ertr1013@student.uu.se To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message