![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Problem with csh script | rahulrathod | Shell Programming and Scripting | 4 | 02-21-2008 12:38 PM |
| script problem | tdavenpo | Shell Programming and Scripting | 3 | 01-04-2006 04:07 PM |
| Problem starting a script from a 'main'-script | Rakker | UNIX for Dummies Questions & Answers | 3 | 06-28-2005 09:12 AM |
| problem with a script | Lestat | Shell Programming and Scripting | 4 | 06-13-2005 01:30 PM |
| problem with ftp script...please help | vancouver_joe | UNIX for Advanced & Expert Users | 2 | 11-22-2001 07:47 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Some problem with script.
guys i have a Script was not written by me... that delete a particular file once it ages 7 days...
never the less, the script is not working as planed... can someone help me out? @fields = split( /\./, $logname ); $_ = $fields[1]; # get roll over time # $1 $2 $3 # Y Y Y Y M M D D /(\d\d\d\d)(\d\d)(\d\d)/; $year = $1 - 1900; <-----WHY 1900?? $month = $2 - 1; <----- one month back??? $day = $3; $time_of_log = timelocal( 0, 0, 0, $day, $month, $year ); if ($time_of_log < $time_expired) { # delete file $filename = $dirname . "/" . $logname; unlink $filename; ERROR received, Use of uninitialized value in subtraction (-) at ./script line 81. Use of uninitialized value in subtraction (-) at ./script line 82. Month '-1' out of range 0..11 at ./script line 85 I don't understand some of the lines here... is there a software that would show you the output for each line? i think that would help tremendously! |
|
||||
|
$logname doe not have a value. It appears to be a filename with an embedded date/time stamp.
UNIX time (internal) is a number of seconds since an arbitrary starting time.... 1900 is the 'earliest' year, so 2006 would be year 106 which is 2006 - 1900. Months start counting from zero ie., Jan = zero , Feb = 1.... |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|