![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| listing files that does not belong to current date | esh.mohan | UNIX for Dummies Questions & Answers | 3 | 02-20-2006 12:24 PM |
| listing files that do not belong to current date | esh.mohan | Shell Programming and Scripting | 1 | 02-20-2006 10:38 AM |
| Listing the creation date/time of a file in unix | unipepper | Shell Programming and Scripting | 6 | 02-15-2006 07:10 AM |
| Recursive directory listing without listing files | psingh | UNIX for Dummies Questions & Answers | 4 | 05-10-2002 11:52 AM |
| long listing of files up to a given date | rlh | UNIX for Dummies Questions & Answers | 2 | 10-27-2000 10:43 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Listing tomorrows date
I am writing a script to strip data from a log, strip last month and empty the log for the comming month. It works great at the moment, but during testing I decided to change the date to 12/31 and when I ran it, it did not find tomorrows date. Further testing revealed that no dbl digit month would pick up the next months date.
I am using "TZ=CST6CDT-24 date +%d" to list tomorrows date, ie... Code:
# # date 07311300 Fri Jul 31 13:00:18 CDT 2009 # TZ=CST6CDT-24 date +%d 01 I can set the date to 0731 and it works fine, but if I do a month with dbl digits (10, 11, 12) it returns like below.... Code:
# date 10311300 Sat Oct 31 13:00:22 CDT 2009 # TZ=CST6CDT-24 date +%d 31 Does anyone have an explanation? Here is the actual script... Code:
#! /bin/ksh
# TZ=CST+24 date +%Y-%m-%d (yesterday)
# TZ=CST-24 date +%Y-%m-%d (tomorrow)
day=$(date '+%d')
month=`TZ=CST6CDT+24 date +%m`
year=`TZ=CST6CDT+24 date +%Y`
if test `TZ=CST6CDT-24 date +%d` = 01; then
echo $month
echo $year
grep $month/[0-9][0-9]/$year /tmp/ftp.log > ftp.log.$year.$month
>ftp.log
fi
Dave |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|