1

How to make diff print a full file diff when a file does not exist?

view story
linux-howto

http://unix.stackexchange.com – I'm trying to compare files on the root file system with a backup, and I'd like the comparison to work a bit like git or svn diff when a file has been added or removed - That is, display the full file diff. diff unfortunately just prints a No such file or directory message, which is not very useful. I couldn't find an option for this. The simplest workaround I could find is to parse the diff output and diff -u path <(printf '') or diff -u <(printf '') path depending on which path exists. That's a bit of a kludge - Probably 10 lines of code for what could be a simple diff option. Anothe (HowTos)