From owner-freebsd-current Sat Apr 21 8:27: 8 2001 Delivered-To: freebsd-current@freebsd.org Received: from lurza.secnetix.de (lurza.secnetix.de [212.66.1.130]) by hub.freebsd.org (Postfix) with ESMTP id 519DD37B423 for ; Sat, 21 Apr 2001 08:27:05 -0700 (PDT) (envelope-from olli@lurza.secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.9.3/8.9.3) id RAA06452; Sat, 21 Apr 2001 17:27:04 +0200 (CEST) (envelope-from oliver.fromme@secnetix.de) Date: Sat, 21 Apr 2001 17:27:04 +0200 (CEST) Message-Id: <200104211527.RAA06452@lurza.secnetix.de> From: Oliver Fromme To: freebsd-current@FreeBSD.ORG Reply-To: freebsd-current@FreeBSD.ORG Subject: Re: cp -d dir patch for review (or 'xargs'?) In-Reply-To: <21060.987865322@axl.fw.uunet.co.za> X-Newsgroups: list.freebsd-current User-Agent: tin/1.5.4-20000523 ("1959") (UNIX) (FreeBSD/4.1-RELEASE (i386)) MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Sheldon Hearn wrote: > On Sat, 21 Apr 2001 16:51:24 +0200, Oliver Fromme wrote: > > That can overflow your shell's command line limit (at the > > "for" command). True, our /bin/sh doesn't has such a > > limit, AFAIK, but there _are_ shells that do). > > That's actually my point. What's being proposed is a non-standard > extension to work around a problem on a system that already doesn't have > the problem. Maybe I didn't make myself clear enough. We _do_ have a problem. Not all users use /bin/sh. Scripts needn't be written in /bin/sh, and xargs can be used interactively, too (I use it a lot). Just because _our_ xargs works fine with _our_ /bin/sh doesn't mean there is no problem. And then there's the gross efficiency problem. Try these alternatives and compare how long they take: for i in `find /usr/ports -type f`; do cat $i >/dev/null done find /usr/ports -type f | xargs cat >/dev/null The latter is a hell of a lot faster. (The example uses "cat" just because it works with xargs.) By the way, the first (inefficient) approach could be rewritten like this: find /usr/ports -type f | while read i; do cat $i >/dev/null done This avoid the potential line limit problem, but of course it's just as inefficient. Regards Oliver -- Oliver Fromme, secnetix GmbH & Co KG, Oettingenstr. 2, 80538 München Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "All that we see or seem is just a dream within a dream" (E. A. Poe) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message