From owner-freebsd-questions Tue May 16 8:17:59 2000 Delivered-To: freebsd-questions@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 4C14D37B8BD for ; Tue, 16 May 2000 08:17:47 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from strontium.scientia.demon.co.uk ([192.168.91.36] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.12 #1) id 12rhLn-0006r4-00; Tue, 16 May 2000 14:25:31 +0100 Received: (from ben) by strontium.scientia.demon.co.uk (Exim 3.12 #7) id 12rhLm-000Hux-00; Tue, 16 May 2000 14:25:30 +0100 Date: Tue, 16 May 2000 14:25:30 +0100 From: Ben Smithurst To: Nicolas Perreten Cc: "Olivier Cortes (ML)" , Alex Boisvert , FreeBSD Questions Subject: Re: PID of a forked process Message-ID: <20000516142530.E10128@strontium.scientia.demon.co.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Nicolas Perreten wrote: > With the above, you risk reading the PID of the grep process.. > > ps ax | grep "my_process" | grep -v grep | cut -c1-6 is a better bet. ps ax | awk '/[m]y_process/ { print $1 }' is even better since you only use two processes instead of four. :-) -- Ben Smithurst / ben@scientia.demon.co.uk / PGP: 0x99392F7D To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message