The traffic is waiting outside

Saturday, 26 August 2006

A tool suggestion for moreutils

haschanged

The intention of haschanged is to test whether a file has changed.

It will do this by computing a hash of a file contents and storing that in a file beneath ~/.haschanged.

If a new hash differs from the previously stored hash, or there is no recorded hash it will return 1 0.

If the new hash and the old hash remain the same then the tool will return 0 1.

The script is trivial, but fairly useful for a lot of things.

The only thing that I don’t like is having to store the hash somewhere… (The alternative is to copy the file somewhere, or create “${file}.orig”, and then run diff. The latter doesn’t work for non-root users wanting to monitor a file in /etc.)

| No comments

 

 

Recent Posts

Recent Tags