Copy source to dest if source and dest are not the same file


Sometimes I’m using that in makefiles because some (texture) tools regenerate same output when inputs have been modified, so it prevents following rules of being remade

$ function cpifdiff() { diff $1 $2 | cp $1 $2 }
$ cpifdiff source dest