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 and shell scripting languages 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 03:18 PM
compare file size from a output file from a script moustik Shell Programming and Scripting 7 11-07-2007 10:17 AM
How to extract output from a script to .xls file scriptlearner Shell Programming and Scripting 6 08-10-2007 03:34 AM
scp output fm script won't go to file nmikes Shell Programming and Scripting 7 01-31-2007 06:53 PM
Output of script to a file sumeet UNIX for Advanced & Expert Users 3 11-29-2006 12:12 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-01-2005
cheo_pr cheo_pr is offline
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.
  #2 (permalink)  
Old 09-01-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,763
Code:
df -k > `date +%Y%m%d`.log
  #3 (permalink)  
Old 09-01-2005
cheo_pr cheo_pr is offline
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
  #4 (permalink)  
Old 09-01-2005
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,763
Do you have the backticks? Try this to see what you are getting
Code:
var="`date +%Y%m%d`.log"
echo $var
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:26 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0