On Sat, 5 Mar 2016, Timo Buhrmester wrote:
Not really, because this is about the 'cp -i' part rather than the 'yes n'.
Consider the latter an alias for ``while true; do echo n; done'' :-).
while echo n; do done
is shorter (and even faster). But it doesn't help either.
'pax', which is the POSIX replacement for 'cpio' and 'tar', has a -k
option for not overwriting existing files. A simple
pax -rwk ${files} dst/
should do nicely.
It works when the ${files} contains filenames only, not pathnames.
To mimic cp(1) more closely you need something like:
$ pax -rwk -s "@^.*/@@" ${files} dst/
If there are directories among ${files}, don't forget that pax(1) works
recursively.
Regards,
David