# Is it a Diff or not?

Your program will be run an undetermined amount of times. On all but the last, there will be a file called data in the same directory of your program that has the same value each time. On the last run, the file will be there but will have different data in it. On all the times except the last, you can do whatever you want, as long as the following rules are met:

• Don't output anything
• Don't change data file

On the last run, you must print out the diff of the first data file and the current data file.

Rules:

• You may save whatever you want in any files you want, just don't edit the data file

Scoring:

• Lowest char score wins

Cheating encouraged. You have no indication of which run you're in except that the data file is changed.

• what's the definition of "diff"? – Doorknob Dec 23 '13 at 2:36
• also, what is the possible contents of data? Can we assume it contains all alphanumeric characters? – Doorknob Dec 23 '13 at 2:38
• @DoorknobofSnow en.wikipedia.org/wiki/Diff – Iszi Dec 23 '13 at 3:13
• what I meant is, can we do something like -olddata +newdata? what is the format of the diff? – Doorknob Dec 23 '13 at 3:13
• On all the times except the last, we don't output anything. How is the "last run" defined? – KGo Dec 23 '13 at 7:39

## Bash (31)

[ -e x ]&&diff data x;cp data x


Kinda obvious.

Here it is with good ol' Windows batch:

@echo off
if exist lastdata goto compare_data
type data > lastdata
goto end
:compare_data
fc data lastdata > nul
if errorlevel 1 goto last
if errorlevel 0 goto end
:last
fc data lastdata
del lastdata
:end