Shell Scripts and variables
adrian at econ-outlook.com.au
Mon Aug 16 12:43:21 CST 1999
you have several syntax problems
.. wrong set syntax
.. wrong use of " should be backquote `
there are several ways by I'd use this:
export DATE=$(date '+%Y%m')
On Mon, 16 Aug 1999, Darryl Ross wrote:
> Hey All,
> First off, please note my new email address,
> rosdr001 at lux.levels.unisa.edu.au instead of linux at bachblue.com.au. Thanks
> I'm trying to set up a script that will be run through cron, and once a
> month, it will tar up my website files, as well as important config files,
> and email that to me. However, I am having a problem getting the variable
> to work. This is the script as I have it so far:
> set DATE="date '+%Y%m'"
> export DATE
> tar -cpz -f "/backups/webbackup-$DATE.tgz" --atime-preserve \
> /www \
> /home/httpd \
> When I run the scripts, I get a message about it removing the leading /s
> from the filenames, which is fine. But when I have a look in the /backups
> directory, there is a file called:
> It doesn't seem to be recognising the $DATE. My question is how do I get
> it to use the $DATE inside a script file??
> If I type:
> date '+%Y%m'
> at the command prompt, I get:
> Which is what I want.
> My systems is a standard RH5.2 running on a 6x86-166MMX and 64Mb RAM.
> Cheers, and TIA
> Check out the LinuxSA web pages at http://www.linuxsa.org.au/
> To unsubscribe from the LinuxSA list:
> mail linuxsa-request at linuxsa.org.au with "unsubscribe" as the subject
Check out the LinuxSA web pages at http://www.linuxsa.org.au/
To unsubscribe from the LinuxSA list:
mail linuxsa-request at linuxsa.org.au with "unsubscribe" as the subject
More information about the linuxsa