From owner-freebsd-questions Tue Oct 20 10:57:57 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id KAA13416 for freebsd-questions-outgoing; Tue, 20 Oct 1998 10:57:57 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from awfulhak.org (awfulhak.force9.co.uk [195.166.136.63]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id KAA13317 for ; Tue, 20 Oct 1998 10:57:22 -0700 (PDT) (envelope-from brian@Awfulhak.org) Received: from woof.lan.awfulhak.org (brian@woof.lan.awfulhak.org [172.16.0.7]) by awfulhak.org (8.8.8/8.8.8) with ESMTP id SAA18135; Tue, 20 Oct 1998 18:56:16 +0100 (BST) (envelope-from brian@Awfulhak.org) Received: from woof.lan.awfulhak.org (brian@localhost [127.0.0.1]) by woof.lan.awfulhak.org (8.9.1/8.9.1) with ESMTP id NAA08042; Tue, 20 Oct 1998 13:20:57 +0100 (BST) (envelope-from brian@woof.lan.awfulhak.org) Message-Id: <199810201220.NAA08042@woof.lan.awfulhak.org> X-Mailer: exmh version 2.0.2 2/24/98 To: "Jason C. Wells" cc: FreeBSD-questions Subject: Re: Getting 'find' to stop finding In-reply-to: Your message of "Mon, 19 Oct 1998 21:58:40 PDT." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 20 Oct 1998 13:20:57 +0100 From: Brian Somers Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I am writing a little shell script. I would like 'find' to stop searching > after it finds it's first match. I don't see any incantation in 'man find' > that can do this. > > Specifically, I am iterating on this command several-teen times and it is > taking WAAAY too long. :) > > find /usr/ports -name SomeInstalledPort -type d > cp -R /usr/ports/SomeInstalledPort SomeVeryCoolDir > > What can I use to do the same function as 'find' that will stop searching > after a match? Try find /usr/ports -name SomeInstalledPort -type d | head -1 The ``find'' gets a SIGPIPE after the first line of output when `head' exits. You may want to investigate the ``make search key=whatever'' facility too. > Catchya Later, | UW Mechanical Engineering > Jason Wells | http://weber.u.washington.edu/~jcwells/ -- Brian , , Don't _EVER_ lose your sense of humour.... To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message