Technical question about scripts

Jonathan Chen jonc at chen.org.nz
Wed Apr 2 19:08:51 PST 2003


On Wed, Apr 02, 2003 at 08:57:48PM -0500, Dragoncrest wrote:
> 	I've got a bit of a technical question about doing scripts.  I've 
> 	created a script that I use for expediting changes to one of my servers to 
> save me a large number or repetitive steps that I have to do.  My question 
> is this though.  Using either Pico or VI I need to be able to have the 
> script know if I've saved/changed the file or if I just exited out without 
> saving my changes.  Cause if I exited out without saving changes, I want it 
> to abort the rest of the script, but if I changed any one of my config 
> files, I want it to then complete the rest of the script.  Anyone know how 
> to do this via a shell script?

Keep a md5 checksum of the old file. If the checksum differs on the
file after edit, it must have changed.
-- 
Jonathan Chen <jonc at chen.org.nz>
----------------------------------------------------------------------
                                             When all else fails, RTFM


More information about the freebsd-questions mailing list