From owner-freebsd-current Sat Feb 20 12:16:38 1999 Delivered-To: freebsd-current@freebsd.org Received: from janus.syracuse.net (janus.syracuse.net [205.232.47.15]) by hub.freebsd.org (Postfix) with ESMTP id 83EB9119F3 for ; Sat, 20 Feb 1999 12:14:37 -0800 (PST) (envelope-from green@unixhelp.org) Received: from localhost (green@localhost) by janus.syracuse.net (8.8.8/8.8.7) with ESMTP id PAA00902; Sat, 20 Feb 1999 15:13:56 -0500 (EST) Date: Sat, 20 Feb 1999 15:13:56 -0500 (EST) From: Brian Feldman X-Sender: green@janus.syracuse.net To: Rahul Dhesi Cc: current@FreeBSD.ORG Subject: Re: sh(1) -- exec vs. fork In-Reply-To: <199902200258.AA26119@waltz.rahul.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Fri, 19 Feb 1999, Rahul Dhesi wrote: > Many years ago I posted a shell script to Usenet in which I prepended a > line with 'exec', in an attempt to avoid having a shell process hanging > around doing a wait(). David Korn himself (of Korn shell fame) > responded saying this was not necessary, as the shell would do exec() > anyway. > > I check with trace() on a Sun and he seemed to be right. This was for > the classic Bourne shell many years ago. > > But I just checked /bin/sh on 3.1-RELEASE with ktrace and the above does > not seem to be true. I get drastically different traces for > > #! /bin/sh > exec /bin/pwd > > and > > #! /bin/sh > /bin/pwd > > Rahul I know that the FreeBSD Bourne shell doesn't do this, nor does the PDKSH. I checked and the copy of the AT&T Korn shell I have (for BSDi) does do what David Korn says. > > > Date: Fri, 19 Feb 99 11:43:59 EST > > From: Mikhail Teterin > > To: current@freebsd.org > > Message-Id: <199902191644.LAA08791@misha.cisco.com> > > Subject: sh(1) -- exec vs. fork > > Reply-To: mi@aldan.algebra.com > > > I just finished going through a couple of crontabs prepending the > > command-lines with ``exec'', when it hit me. > > > > Can shell itself recognize, there will be no more commands and just > > proceed to exec without forking? What would this break? > ... > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-current" in the body of the message > Brian Feldman _ __ ___ ___ ___ green@unixhelp.org _ __ ___ | _ ) __| \ http://www.freebsd.org/ _ __ ___ ____ | _ \__ \ |) | FreeBSD: The Power to Serve! _ __ ___ ____ _____ |___/___/___/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message