From owner-freebsd-hackers Tue May 15 9:53:12 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by hub.freebsd.org (Postfix) with ESMTP id 4388237B422 for ; Tue, 15 May 2001 09:53:08 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.acs.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.11.3/8.11.3) with ESMTP id f4FGr0A81550; Tue, 15 May 2001 12:53:00 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: In-Reply-To: <20010515065234.8412C3E0B@bazooka.unixfreak.org> References: <20010515065234.8412C3E0B@bazooka.unixfreak.org> Date: Tue, 15 May 2001 12:52:57 -0400 To: Dima Dorfman , Peter Pentchev From: Garance A Drosihn Subject: Re: xargs(1) "replstr" patch Cc: hackers@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG At 11:52 PM -0700 5/14/01, Dima Dorfman ably wrote: >This is a simplistic example that can be done in many other ways >(including using -J), but it shows what -I is supposed to be able to >do. -J doesn't work with the above since it only looks for the >replstr once, and will not find it unless it's given as a separate >argument. For example, this works: > > xargs -J [] echo this is [] a test > >but this does not: > > xargs -J [] echo this is[] a test It should be noted that this was a deliberate design decision, as it was not clear what -J *should* do when '-n' is effectively greater than 1. For instance, should: echo a b | xargs -J [] cp src/[] dest generate: cp 'src/a src/b' dest or: cp 'src/a b' dest or: cp 'src/a' 'src/b' dest ? That last one is obviously the most likely to be useful, but then consider: echo a b | xargs -J [] echo "Do the MFC of [] tomorrow! " which becomes echo 'Do the MFC of a tomorrow! ' 'Do the MFC of b tomorrow! ' The problem, imo, is that you don't know why the replstr is only a substring of the argument specified to xargs. The upshot of this is that -J deliberately requires that the replstr be specified as a distinct argument to xargs, and replstr is not recognized if it is a substring of some argument. That, in turn, made it pretty easy to implement in the current source for 'xargs'. >That said, -I isn't all that hard to implement. It's just hard to >implement without rewriting xargs as it is. [...] > >Just food for thought, I guess. I'm sure Garance wouldn't mind if >someone did this for him :-). I am hoping to find some student and sucker, er, I mean, "encourage" them into implementing -I, and then I'll just review the change... -- Garance Alistair Drosehn = gad@eclipse.acs.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message