From owner-freebsd-hackers@FreeBSD.ORG Wed Nov 2 20:37:08 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8ADBD1065679 for ; Wed, 2 Nov 2011 20:37:08 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 1DE548FC1C for ; Wed, 2 Nov 2011 20:37:07 +0000 (UTC) Received: by wyg36 with SMTP id 36so755721wyg.13 for ; Wed, 02 Nov 2011 13:37:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=3RrzEsEcHo+B49sP0DMZYvkHO95lIpv6hU8VmVUWyTM=; b=BtK6yXkMb+t+hx32XNOJ2ww/b+tpzak1IpGQdUD0toAypWuzVSTUgJmvFKMBUSN07v zQe/zonxEjXMcSzdP4AlkoMuQy8Ey61BhzODuG0UrBohSut8p0ZXKKkmwC36nBIRwb8W Uw+Uy+1A6un8BMukZ3Hu/qR3rjdgly8rBoiUM= MIME-Version: 1.0 Received: by 10.216.133.155 with SMTP id q27mr698711wei.101.1320266226918; Wed, 02 Nov 2011 13:37:06 -0700 (PDT) Received: by 10.180.8.34 with HTTP; Wed, 2 Nov 2011 13:37:06 -0700 (PDT) In-Reply-To: References: Date: Wed, 2 Nov 2011 16:37:06 -0400 Message-ID: From: Ryan Stone To: Mark Saad Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org Subject: Re: What is going on with ash / sh X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Nov 2011 20:37:08 -0000 On Wed, Nov 2, 2011 at 4:28 PM, Mark Saad wrote: > Hackers > =A0What is going on here, if I run the following shell script, what is > the expected output . The script is named xxx > > #!/bin/sh > ps -ax | grep -v grep | grep xxx > > Here is what I see > > > =A0# sh xxx > 88318 =A0p0 =A0S+ =A0 =A0 0:00.00 sh xxx > 88320 =A0p0 =A0R+ =A0 =A0 0:00.00 sh xxx > 88321 =A0p0 =A0R+ =A0 =A0 0:00.00 sh xxx > > > Can someone explain this ? ps is happening to run after sh has forked off the two grep processes but before they exec'ed grep?