The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
2 ftps in script, second won't go to output file brdholman UNIX for Dummies Questions & Answers 4 11-15-2007 12:18 PM
compare file size from a output file from a script moustik Shell Programming and Scripting 7 11-07-2007 07:17 AM
How to extract output from a script to .xls file scriptlearner Shell Programming and Scripting 6 08-09-2007 11:34 PM
scp output fm script won't go to file nmikes Shell Programming and Scripting 7 01-31-2007 03:53 PM
Output of script to a file sumeet UNIX for Advanced & Expert Users 3 11-29-2006 09:12 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 09-01-2005
Registered User
 

Join Date: Sep 2005
Posts: 2
Exclamation File name of a script output

I have a script that run every morning, but I need the output file to have the date in the name.

example:

df -k > 01092005.log

the bold part is what I need. I tried df -k >${DATE}.log but doesn't work.
Reply With Quote
Forum Sponsor
  #2  
Old 09-01-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Code:
df -k > `date +%Y%m%d`.log
Reply With Quote
  #3  
Old 09-01-2005
Registered User
 

Join Date: Sep 2005
Posts: 2
Quote:
Originally Posted by jim mcnamara
Code:
df -k > `date +%Y%m%d`.log
when i try this the output file was created like this:

date +%Y%m%d`.log

I don't get the current day
Reply With Quote
  #4  
Old 09-01-2005
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 4,298
Do you have the backticks? Try this to see what you are getting
Code:
var="`date +%Y%m%d`.log"
echo $var
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:10 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0