From owner-freebsd-stable Wed Aug 7 7:56:46 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 2A94B37B400; Wed, 7 Aug 2002 07:56:44 -0700 (PDT) Received: from mail1.qc.uunet.ca (mail1.qc.uunet.ca [198.168.54.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id 64EAC43E65; Wed, 7 Aug 2002 07:56:43 -0700 (PDT) (envelope-from anarcat@anarcat.ath.cx) Received: from xtanbul (IDENT:506@[216.94.147.34]) by mail1.qc.uunet.ca (8.10.2/8.10.2) with ESMTP id g77EudN14291; Wed, 7 Aug 2002 10:56:39 -0400 Date: Wed, 7 Aug 2002 10:46:23 -0400 Subject: Re: /bin/sh changed? Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v482) Cc: "C.J." , , To: Gavin Atkinson From: Antoine Beaupre In-Reply-To: Message-Id: <71A173FE-AA14-11D6-9D65-0050E4A0BB3F@anarcat.ath.cx> Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.482) 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 Wednesday, August 7, 2002, at 05:40 AM, 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. Thechnically, '&&' means run RHS if LHS succeeds (RHS: Right Hand Side, LHS: Left). Since foo & isn't ran in a subshell, there's no exit status, since there's no exit! So it's not a valid construct, period. I've stumbled upon this in my early shell coding days. A. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message