tar problem
Roop Nanuwa
roop.nanuwa at gmail.com
Thu Jul 1 19:57:11 PDT 2004
On Thu, 01 Jul 2004 22:28:23 -0400, Bruce Hunter <freebsd at 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
More information about the freebsd-questions
mailing list