Linux Help
guides forums blogs
Home Desktops Distributions ISO Images Logos Newbies Reviews Software Support & Resources Linuxhelp Wiki

Welcome Guest ( Log In | Register )



Advanced DNS Management
New ZoneEdit. New Managment.

FREE DNS Is Back

Sign Up Now
> trim-log-files script PLEASE HELP!! URGENT!, script debugging
afs5982
post Apr 19 2006, 07:43 PM
Post #1


Whats this Lie-nix Thing?
*

Group: Members
Posts: 2
Joined: 20-March 06
Member No.: 6,189



I was hoping someone could help me out a little bit. I have a script that I got off a web page to trim older log files but I can't get it to work and I don't know enough about scripting to debug it myself. it says there are errors in lines 9 and 16 but those are my 2 'do' lines. I'm assuming that this means that there is an issue within my 'do' command but I don't know what. I am also guessing that it is in the date portion of the script but I don't know how I should do it differently (or fill it in). Can you help? here's my script:

#!/bin/sh
#trim-log-files
cd /var/log || exit 1
for i in $(find . –type f –maxdepth 1)
do
filename=$(echo $i | sed `s?^./(.*)?1?`)
cp –p $i old/$(date +%Y%m%d`).$filename
> $i
done
cd /var/log/httpd || exit 2
for i in $(find . –type f –maxdepth 1)
do
filename=echo $i | sed `s? ^./(.*)?1?`)
cp –p $i old/$(date +`%Y%m%d`).$filename
> $i
done


Please let me know if you have anything!! Thanks in advance.
Go to the top of the page
 
+Quote Post

Posts in this topic


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 19th October 2017 - 08:39 PM