From owner-freebsd-questions@FreeBSD.ORG Thu Apr 3 05:24:15 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DAE9A37B401 for ; Thu, 3 Apr 2003 05:24:15 -0800 (PST) Received: from gv-m2.usfamily.net (gv-m2.usfamily.net [207.225.145.202]) by mx1.FreeBSD.org (Postfix) with SMTP id F388743FCB for ; Thu, 3 Apr 2003 05:24:14 -0800 (PST) (envelope-from Curt_Grimley@usa.net) Received: from [64.212.141.149] by usfamily.net (USFamily MTA v1.0.6) with SMTP id com for ; Thu, 03 Apr 2003 07:22:45 -0600 (CST) From: "Curt Grimley" To: "'Dragoncrest'" Date: Thu, 3 Apr 2003 07:23:31 -0600 Message-ID: <002a01c2f9e4$3ecc47b0$0100a8c0@grimleyhome.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook CWS, Build 9.0.2416 (9.0.2911.0) In-Reply-To: <20030403030847.GA11156@grimoire.chen.org.nz> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Importance: Normal cc: freebsd-questions@freebsd.org Subject: RE: Technical question about scripts X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Apr 2003 13:24:16 -0000 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 ---------------------------------------------------------------------- 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"