LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   shell command script question.... (https://www.linuxquestions.org/questions/linux-software-2/shell-command-script-question-544970/)

Basslord1124 04-10-2007 07:31 PM

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 wanting...is that basically what I need to do?

anomie 04-10-2007 08:34 PM

Review the date(1) manpages (FORMAT section). Example:
Code:

[hector@troy ~]$ FILENAME=mylog$(date +%Y%m%d).log
[hector@troy ~]$ echo $FILENAME
mylog20070410.log


Basslord1124 04-11-2007 04:36 PM

Awesome, thanks. :)

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


All times are GMT -5. The time now is 09:46 AM.