Date: Fri, 20 Apr 2001 00:57:29 -0400 From: Garance A Drosihn <drosih@rpi.edu> To: "John W. De Boskey" <jwd@bsdwins.com>, Current List <freebsd-current@FreeBSD.ORG> Subject: Re: cp -d dir patch for review (or 'xargs'?) Message-ID: <p05100c06b7056ad7a6f3@[128.113.24.47]> In-Reply-To: <20010419153913.A74863@bsdwins.com> References: <20010419153913.A74863@bsdwins.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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: > http://www.freebsd.org/~jwd/cp-d.patch > >which allows: > cp -d target_directory source1 source2 ... sourceN > >and/or > 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 = 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-current" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05100c06b7056ad7a6f3>