From owner-freebsd-questions Tue Aug 20 7:19:42 2002 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 C8F4837B400 for ; Tue, 20 Aug 2002 07:19:38 -0700 (PDT) Received: from slate.dublin.wbtsystems.com (slate.dublin.wbtsystems.com [193.120.231.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id C5B4743E42 for ; Tue, 20 Aug 2002 07:19:37 -0700 (PDT) (envelope-from barry.byrne@wbtsystems.com) Received: from spiral (spiral.dublin.wbtsystems.com [193.120.231.190]) (authenticated bits=0) by slate.dublin.wbtsystems.com (8.12.5/8.12.5) with ESMTP id g7KEJYHI037578; Tue, 20 Aug 2002 15:19:34 +0100 (IST) From: "Barry Byrne" To: "MET" , "'freebsd-questions-en'" Subject: RE: A simple Shell script Question || Printing the date in a file name Date: Tue, 20 Aug 2002 15:19:33 +0100 Message-ID: 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 IMO, Build 9.0.2416 (9.0.2910.0) In-Reply-To: <001701c24854$4f031510$6901a8c0@SURVIVAL> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal X-Scanned-By: slate/MIMEDefang 2.17 (www . roaringpenguin . com / mimedefang) 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 #!/bin/sh DATE = `date +%Y-%m-%d`; ARCHIVED="Gunks-$DATE.tar.bz2"; tar cjf $ARCHIVED Gunks.txt - Barry -- Barry Byrne, IT Manager, WBT Systems, Block 2, Harcourt Centre Harcourt Street, Dublin 2, Ireland Email: barry.byrne@wbtsystems.com Web: www.wbtsystems.com > -----Original Message----- > From: owner-freebsd-questions@FreeBSD.ORG > [mailto:owner-freebsd-questions@FreeBSD.ORG]On Behalf Of MET > Sent: 20 August 2002 15:17 > To: 'freebsd-questions-en' > Subject: A simple Shell script Question || Printing the date in a file > name > > > I have a simple shell script that archives and compresses the output of > a PHP script and then moves it to another location. However, every time > it runs it replaces the backup that was previously there. So naturally > to keep this from happening the file names have to be different. So I > wanted to print the date in a file name. For example > > filename-8-20-2002.tar.bz2 > > So how might I do that? > > I'm archiving/compressing like this - and that's when I'd like the date > to be appended to the name. > > tar cjf Gunks-{insert date}.tar.bz2 Gunks.txt > > ~ Matthew > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message