From owner-freebsd-questions Mon Feb 10 8:39:58 2003 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 C402A37B405 for ; Mon, 10 Feb 2003 08:39:56 -0800 (PST) Received: from sage-american.com (adsl-65-71-135-139.dsl.crchtx.swbell.net [65.71.135.139]) by mx1.FreeBSD.org (Postfix) with ESMTP id 690C343FBD for ; Mon, 10 Feb 2003 08:39:55 -0800 (PST) (envelope-from jackstone@sage-one.net) Received: from sagea (sagea.sage-american [192.168.0.3]) by sage-american.com (8.12.6/8.12.6) with SMTP id h1AGdr4K026896; Mon, 10 Feb 2003 10:39:53 -0600 (CST) (envelope-from jackstone@sage-one.net) Message-Id: <3.0.5.32.20030210103954.020a3680@sage-one.net> X-Sender: jackstone@sage-one.net X-Mailer: QUALCOMM Windows Eudora Pro Version 3.0.5 (32) Date: Mon, 10 Feb 2003 10:39:54 -0600 To: "Dave [Hawk-Systems]" , From: "Jack L. Stone" Subject: Re: shell script to backup files with datestamp In-Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, hits=0.0 required=4.5 tests=IN_REP_TO,SPAM_PHRASE_00_01 version=2.44-sageamerules_v1 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG At 11:19 AM 2.10.2003 -0500, Dave [Hawk-Systems] wrote: >Without dumping to perl or another external language, would like to accomplish >the following; > >prior to making changes in a file, backup incrementially the current file to >create a record of changes ans versions. For example. > >we are about to make changes to file.conf and would like to make a copy of our >current file before doing so *without* overwriting previous backup copies > > #cp /path/to/file.conf /path/to/file.conf.20030210 > >I almost want to say this could be done with something simple like > > #cp /path/to/file.conf /path/to/file.conf.$DATE > >which would be the solution if I was using perl, php, or soething else to >accomplish the copy of files, but would prefer a simple one liner without having >to load another processor just for this one command. > >Suggestions would be appreciated. > >Dave > If you use "date" as follows, it will take it out to the month, day, hour and minute cp ../file.conf`date +".%m.%d.%H.%M"` ...will give: file.conf.02.06.04.45 Best regards, Jack L. Stone, Administrator SageOne Net http://www.sage-one.net jackstone@sage-one.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message