Is there a way to tell
--link (i.e. create hard links), but fall back in the case where I am attempting inter-device hardlinks? Inter-device links aren't possible and would cause
cp to fail.
The reason I am asking is because I would like to use this in a
GNUmakefile and would prefer a readable command line over some convoluted and lengthy one (or a function, for that matter).
The question is for GNU coreutils (7.4 and 8.13).
Note: right now the workaround would be something like (GNU make recipe syntax):
cp -fl $^ $@ || cp -f $^ $@
This will of course give spurious error messages in case of inter-device links, although succeeding on the second
cp call then. Also, then this gets expanded (source form looks readable after all) it won't be too readable anymore.