Can you tell cp (GNU coreutils) to prevent reporting an error on:
$ echo 1 > foo
$ cp foo foo
Currently, this reports:
cp: 'foo' and 'foo' are the same file
That's very sensible, but it's not always necessarily going to be an error. Conceptually, if you are copying files from $source
to $dest
, if you are already in the $dest
directory, then essentially the copy is already done by construction; so, depending on context, this should not necessarily be reported as an error. I can't find anything in the manual page for this. The --update
option doesn't work although it sounded like it might.
Obviously, I can work around this is many ways, but I was wondering if cp could do this off the bat.