Date: Thu, 3 Apr 2003 07:23:31 -0600 From: "Curt Grimley" <Curt_Grimley@usa.net> To: "'Dragoncrest'" <dragoncrest@voyager.net> Cc: freebsd-questions@freebsd.org Subject: RE: Technical question about scripts Message-ID: <002a01c2f9e4$3ecc47b0$0100a8c0@grimleyhome.org> In-Reply-To: <20030403030847.GA11156@grimoire.chen.org.nz>
next in thread | previous in thread | raw e-mail | index | archive | help
Mr. Chen's solution is a good one, and you might simplify it like this: # Where a, b and c are the config files: md5before=`cat a b c | md5` vi a b c md5after=`cat a b c | md5` if [ $md5before = $md5after ] then exit # no changes made fi ------------ Curt Grimley -----Original Message----- From: owner-freebsd-questions@freebsd.org [mailto:owner-freebsd-questions@freebsd.org]On Behalf Of Jonathan Chen Sent: Wednesday, April 02, 2003 9:09 PM To: Dragoncrest Cc: freebsd-questions@freebsd.org Subject: Re: Technical question about scripts 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 _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?002a01c2f9e4$3ecc47b0$0100a8c0>