Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )

Advanced DNS Management
New ZoneEdit. New Managment.


Sign Up Now
Reply to this topicStart new topic
> Automatic File Naming Question
post Feb 20 2004, 11:01 AM
Post #1

Its GNU/

Group: Support Specialist
Posts: 1,439
Joined: 3-January 04
From: Germany
Member No.: 2,069

I use bdc with crontab to make it update at 02:00 and scan for viruses at 04:00 every day, I give the bdc the option to output the report in /viruslog/report.

Now, the question is , is there a character of some sort [variable or something], that I can use after report so that it will make a report2004Feb20 ...report2004Feb21 etc....

Robert B

Robert Becskei
May the source be with us!
AMD X2-3800 @ 2400Mhz
2048MB DDR 400Mhz
DFI Lanparty UT4 NF4 ULTRA-D
GeForce 7800GT
Pioneer DVD-RW
17inch Samsung Syncmaster 757NF
WinXP Pro (SP2)/ CentOS 4.3
Go to the top of the page
+Quote Post
post Feb 20 2004, 08:00 PM
Post #2

Its GNU/

Group: Admin
Posts: 3,433
Joined: 25-July 03
From: Corpus Chrsiti, TX, USA
Member No.: 1,151

I don't know what program you are using, but in a bash script you can create a variable with the date and format it however you want ... here is a simple script:


today=`date +%G%b%d`

echo $today


echo $today_report

First thing to note is that the ` character is the key to the left of the number 1 ... not the ' beside the enter key....

In the SH and BASH shells, setting a variable to something inside `` will cause the command to execute and return the results...

In the above script, you can use a # in front of the echo commands to remark them out and use the variables $today and $today_report

If you would like a different format of the date, see man date for all the formats available.

Johnny Hughes
Enterprise Alternatives: CentOS, WhiteBoxEL
Favorite Workstation Distros (in order): CentOS, Gentoo, Debian Sarge, Ubuntu, Mandrake, FedoraCore, Slackware, SUSE
Favorite Server Distros (in order): CentOS, WhiteBoxEL, Debian Sarge, Slackware, Mandrake, FedoraCore, Gentoo, SUSE
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 23rd June 2018 - 10:46 PM