[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

RE: Date-stamp in filename for a script



You can do some shell like that :

phil.sh
===============================
#! /bin/sh

prefix=$1
suffix=$2
buffer=`date +%y%m%d'

file=${prefix}${buffer}${suffix}

cat > $file

=================================

and use it like that :

ls  |  phil.sh  backup  .tar.gz

Phil. BARBELET
French Guiana - European Space Port


 ----------
De: Jay Barbee
A: debian-user@lists.debian.org
Objet: Date-stamp in filename for a script
Date: mardi 23 juin 1998 20:35

Microsoft Mail v3.0 IPM.Microsoft Mail.Note
From: Jay Barbee
To:  debian-user@lists.debian.org
Subject:  Date-stamp in filename for a script
Date: 1998-06-23 20:35
Priority: 3

 ------------------------------------------------------------------------
---- --

Excuse my ignorance in shell scripting, but I wanted to create a file
that
actualy had a filename that contains the date in the format:

backupYYMMDD.tar.gz

I can do:
date +backup%y%m%d.tar.gz

which give the correct output for the filename.  If I assign that to an
 environment
variable such as TIMESTAMP:

TIMESTAMP='date +backup%y%m%d.tar.gz'

How can I use this as:
touch $TIMESTAMP

...or...

tar czvf $TIMESTAMP /

ect... I have seveal uses for this concept, and I know you guru
scripters do
 this
in your sleep.  any help?

 --Jay


 --
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact
listmaster@lists.debian.org


--  
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org


Reply to: