I'm wondering if I just compare two files, it is
possible to print the diff command if there is a difference between
the two files?

Not in diff itself, but it's easy to do from a shell script.  E.g.,

command="diff a b"
$command >output || {
  echo "$command"
  cat output
}



Reply via email to