Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 1 Jul 2004 19:49:28 -0700
From:      Roop Nanuwa <roop.nanuwa@gmail.com>
To:        Bruce Hunter <freebsd@solisix.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: tar problem
Message-ID:  <75f3f705040701194931a284f6@mail.gmail.com>
In-Reply-To: <1088735303.4072.2.camel@solid.solisixoffice.com>
References:  <1088728604.849.1.camel@solid.solisixoffice.com> <1088735303.4072.2.camel@solid.solisixoffice.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 01 Jul 2004 22:28:23 -0400, Bruce Hunter <freebsd@solisix.com> wrote:
> 
> Thanks, I got it to work. How would I include the current system date
> like this.
> 
> #tar -cvf Solisix-$USER.tar Solisix/     <--- with current user..
> 
> I want the date instead..
> 
> #tar -cvf Solisix-$date.tar Solisix/     <-- doesn't work
> 
> I'm still learning.. sorry
> 

What you're doing when you do $USER is bringing in one of the environment
variables. If you type 'env' at a command prompt, you'll see the ones currently
defined. The date isn't one of them. There might be an easier/better way but I
would suggest running the 'date' command inline with the ` character as so:

tar -cvf Solisix-`date '+%d%m%Y'`.tar Solisix

That runs the 'date' command with a particular formatting string and
then puts that
result into the tar command.

--roop



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?75f3f705040701194931a284f6>