Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Apr 2001 21:06:30 -0600
From:      Brad Huntting <huntting@glarp.com>
To:        Brian Dean <bsd@bsdhome.com>
Cc:        "Rodney W. Grimes" <freebsd@gndrsh.dnsmgr.net>, Jens Schweikhardt <schweikh@schweikhardt.net>, freebsd-current@FreeBSD.ORG
Subject:   Re: cp -d dir patch for review (or 'xargs'?) 
Message-ID:  <200104210306.f3L36UM59719@hunkular.glarp.com>
In-Reply-To: Your message of "Fri, 20 Apr 2001 22:39:43 EDT." <20010420223943.A59039@vger.bsdhome.com> 

next in thread | previous in thread | raw e-mail | index | archive | help

> Try:
> 
>   echo 1 2 3 4 5 6 7 8 9 | xargs -n 4 echo
> 
> Now consider what would happen with the above suggested construct with
> a very long file list.
> 
> I don't see a problem with adding an option to cp to treat the first
> argument as the target instead of the last argument.  It's a simple
> solution, the code change is simple, and it produces the exact desired
> result.  What's the problem?

Unfortunatly, cp is not alone in needing this feature.

I think a more sensable approach would be to add an "append args"
flag to xargs.  For example "--", which could be used like so:

	xargs cp -- destdir <<EOF
		first_file
		second_file
		third file
	EOF

would run

	cp 'first_file' 'second_file' 'third file' destdir

to pass an argument of two or more dashes to the command,
add an extra dash like so:

	xargs echo -- foo --- bar ------ bar  <<EOF
		first_file
		second_file
		third file
	EOF

would run 

	echo 'first_file' 'second_file' 'third file' foo -- bar ----- bar

You get the idea.


brad

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?200104210306.f3L36UM59719>