Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Apr 2001 15:14:10 -0700
From:      Mike Smith <msmith@freebsd.org>
To:        Jens Schweikhardt <schweikh@schweikhardt.net>
Cc:        freebsd-current@freebsd.org
Subject:   Re: cp -d dir patch for review (or 'xargs'?) 
Message-ID:  <200104202214.f3KMEAf06331@mass.dis.org>
In-Reply-To: Your message of "Fri, 20 Apr 2001 23:54:19 %2B0200." <20010420235419.B1276@schweikhardt.net> 

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Folks,
> 
> although there was much rejoicing, I think there's no need for a
> new option to cp. Just use the toolbox, it's not too hard:
> 
> (cat bigfilelist; echo destdir) | xargs cp
>
> Or even
>
> echo destdir >>bigfilelist
> xargs cp < bigfilelist
> 
> should do the trick.

No, it won't.  Consider a list of files  a, b, c, d.  You create input to 
xargs 'a b c d destdir', which it then splits into 'a b c' and 'd 
destdir'.  The first time cp is run, it will probably fail; the second 
time only 'd' ends up where you expect it.

The best solution to this is actually to fix xargs to accept a "command 
format string", eg.

  echo list | xargs "cp %s destdir"

Probably a better way to do it would be to have the insertion marker an 
option to xargs:

  echo list | xargs -s LIST_HERE cp LIST_HERE destdir

-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E



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?200104202214.f3KMEAf06331>