How to use cp from stdin?

cp, cygwin, stdin

Solution

xargs normally places its substituted args last. You could just do:

$ cp `cat /tmp/foo` /tmp/fred/.

If it's really just the lib files, then `cp /lib/?.lib /tmp/fred/.` would naturally work.

And to really do it with `xargs`, here is an example of putting the arg first:

0:~$ (echo word1; echo word2) | xargs -I here echo here how now
word1 how now
word2 how now
0:~$ 

Problem

Note: `# cat /tmp/foo` - regular file ``` /lib/a.lib /lib/b.lib /lib/c.lib /lib/d.lib ``` `cat /tmp/foo | xargs cp /tmp/fred` cp: target /lib/d.lib is not a directory

Original source