At 3:39 PM -0400 4/19/01, John W. De Boskey wrote:
>    I have added a -d dir option to cp. This allows the target
>directory to be specified at the head of the command line
>instead of the tail. This makes cp work much more nicely with
>tools like xargs... (allowing for major performance improvements
>over inline shell loops).
>The patch is at:
>which allows:
>        cp -d target_directory source1 source2 ... sourceN
>        cat big_file_list | xargs cp -d target_directory

While I can see how this is useful for 'cp', it only fixes
that how xargs works wrt that one command.  It doesn't do
anything for 'mv', for instance.

It seems to me that the problem here is due to xargs, not
cp.  What other tools are there like xargs, where this new
option would really be useful?

What I'm wondering is if it would be better to add a new
option to 'xargs' itself.  Something like:
       cat big_file_list | xargs -last target_directory cp

Or maybe something to indicate where the list of arguments
should go in a command.  Hrm.  Let's say '-Y replstr' or
'-y[replstr]' (no blank after -y).  If no [replstr] is
given on -y, it defaults to the two characters '[]'.
Then one might do:
       cat big_file_list | xargs -y cp [] target_directory

This is similar to the '-I' and '-i' parameters on the
xargs command that I see in solaris, except that '-I'
(stands for "insert mode") forces xarg to build a separate
command for each line it is being fed, and for -I/-i the
replstr can be specified multiple times in the command
xargs will be executing.

I picked -Y and -y for no other reason than they didn't
seem to be used...  Any other letter would be fine by me.

I think both -I/-i and -Y/-y would be useful additions to
xargs, and would be a more general solution to the problem
you're trying to address.  On the other hand, the man page
for 'xargs' on FreeBSD says:

      The xargs utility is expected to be IEEE Std 1003.2
      (``POSIX.2'') compliant.

so I don't know how we go about adding options to it.  On
the other hand, that same issue is faced by adding options
to 'cp', as there is a similar claim made in cp's man page.

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-current" in the body of the message

Reply via email to