Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Apr 2003 15:08:47 +1200
From:      Jonathan Chen <jonc@chen.org.nz>
To:        Dragoncrest <dragoncrest@voyager.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Technical question about scripts
Message-ID:  <20030403030847.GA11156@grimoire.chen.org.nz>
In-Reply-To: <5.2.0.9.2.20030402205519.00a05e10@pop.voyager.net>
References:  <5.2.0.9.2.20030402205519.00a05e10@pop.voyager.net>

next in thread | previous in thread | raw e-mail | index | archive | help
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@chen.org.nz>
----------------------------------------------------------------------
                                             When all else fails, RTFM



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030403030847.GA11156>