kalvillo
asked on
"date" parameter in Batch Files (unix)
Hi.
In DOS, there is a paramether that you can use on your batch file that passes the date of the system (for example, "echo %date%").
Is there a similar parameter on Unix?
Thanks.
In DOS, there is a paramether that you can use on your batch file that passes the date of the system (for example, "echo %date%").
Is there a similar parameter on Unix?
Thanks.
ASKER
do you know how to print the ` character on vi?
ASKER
hi...
Let me explain what i'm trying to do...
I want to make a batch file that builds a tar file with the date on the name, for example "file10-02-09"
`date`returns me the complete date (tue feb 10 14:37:00 pst 2009)
Is there a way to do this?
Let me explain what i'm trying to do...
I want to make a batch file that builds a tar file with the date on the name, for example "file10-02-09"
`date`returns me the complete date (tue feb 10 14:37:00 pst 2009)
Is there a way to do this?
#!/bin/bash
name=file`date '+%d-%m-%y'`
echo $name
name=file`date '+%d-%m-%y'`
echo $name
you could also use
name=file$(date '+%d-%m-%y')
name=file$(date '+%d-%m-%y')
ASKER
This is the code of my batch file:
#!/bin/bash
name=file$(date'+%d-%m-%y' )
tar -cvf /respaldo-mail-huevo/gabri el/name.ta r /var/qmail/mailnames/huevo cartoon.co m/gabriel
gzip /respaldo-mail-huevo/gabri el/name.ta r
It creates the following file:
name.tar.gz
It should be
name10-02-09.tar.gz
What am i doing wrong?
#!/bin/bash
name=file$(date'+%d-%m-%y'
tar -cvf /respaldo-mail-huevo/gabri
gzip /respaldo-mail-huevo/gabri
It creates the following file:
name.tar.gz
It should be
name10-02-09.tar.gz
What am i doing wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
gzip /respaldo-mail-huevo/gabri el/$name.t ar
or just
date