Date: Tue, 15 May 2001 12:52:57 -0400 From: Garance A Drosihn <drosih@rpi.edu> To: Dima Dorfman <dima@unixfreak.org>, Peter Pentchev <roam@orbitel.bg> Cc: hackers@FreeBSD.ORG Subject: Re: xargs(1) "replstr" patch Message-ID: <p05100e07b7270bfd57dc@[128.113.24.47]> In-Reply-To: <20010515065234.8412C3E0B@bazooka.unixfreak.org> References: <20010515065234.8412C3E0B@bazooka.unixfreak.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05100e07b7270bfd57dc>