From owner-freebsd-questions@FreeBSD.ORG Wed Apr 2 19:08:51 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 1F2F237B401 for ; Wed, 2 Apr 2003 19:08:51 -0800 (PST) Received: from chen.org.nz (chen.org.nz [210.54.19.51]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2054743F3F for ; Wed, 2 Apr 2003 19:08:50 -0800 (PST) (envelope-from jonc@chen.org.nz) Received: from grimoire.chen.org.nz (localhost [127.0.0.1]) by chen.org.nz (8.12.9/8.12.9) with ESMTP id h3338lU3011190; Thu, 3 Apr 2003 15:08:47 +1200 (NZST) (envelope-from jonc@grimoire.chen.org.nz) Received: (from jonc@localhost) by grimoire.chen.org.nz (8.12.9/8.12.9/Submit) id h3338l1k011189; Thu, 3 Apr 2003 15:08:47 +1200 (NZST) Date: Thu, 3 Apr 2003 15:08:47 +1200 From: Jonathan Chen To: Dragoncrest Message-ID: <20030403030847.GA11156@grimoire.chen.org.nz> References: <5.2.0.9.2.20030402205519.00a05e10@pop.voyager.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5.2.0.9.2.20030402205519.00a05e10@pop.voyager.net> User-Agent: Mutt/1.4.1i 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 03:08:51 -0000 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