Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-10-2007, 07:31 PM   #1
Registered: Jun 2004
Location: Ashland, KY
Distribution: Debian, Puppy/Slacko
Posts: 351

Rep: Reputation: 31
shell command script question....

All right, I am in the process of putting together a small command script to run my IP monitoring software app (iptraf) on my server at boot time. Basically I am wanting it to run in the background and log my traffic. The question I have, is I want to put the current date in the log's filename when it originally gets created. How would I accomplish this? I have seen with some commands that it usually consists of a percent sign followed by some letter (ex: %M) to do certain things similar to what I am that basically what I need to do?
Old 04-10-2007, 08:34 PM   #2
Senior Member
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Review the date(1) manpages (FORMAT section). Example:
[hector@troy ~]$ FILENAME=mylog$(date +%Y%m%d).log
[hector@troy ~]$ echo $FILENAME
Old 04-11-2007, 04:36 PM   #3
Registered: Jun 2004
Location: Ashland, KY
Distribution: Debian, Puppy/Slacko
Posts: 351

Original Poster
Rep: Reputation: 31
Awesome, thanks.

I was kinda figuring that's what I'd have to do but just thought I'd double check to be sure.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
command with shell script sunlinux Programming 2 12-28-2006 11:36 PM
Executing a shell script command!! vishamr2000 Programming 4 08-15-2005 12:33 AM
Command in shell script Grassie Coetzee Linux - Software 1 03-13-2005 11:42 AM
command not found (My shell script) Swift&Smart Linux - Software 3 05-15-2004 11:14 PM
Shell script login command? chup Linux - General 3 08-24-2003 06:43 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 02:49 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration