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 = [EMAIL PROTECTED]
Senior Systems Programmer or [EMAIL PROTECTED]
Rensselaer Polytechnic Institute or [EMAIL PROTECTED]
To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message