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
Whats wrong in the script? nehagupta2008 UNIX for Dummies Questions & Answers 1 06-02-2008 03:24 AM
tell me whats wrong with this nadman123 Shell Programming and Scripting 1 04-14-2008 08:58 PM
Whats wrong in this Script ??? varungupta UNIX for Advanced & Expert Users 4 08-31-2007 01:02 AM
Whats wrong with this 5 line script! c19h28O2 Shell Programming and Scripting 9 05-10-2006 10:04 PM
whats wrong with this awk??? george_ Shell Programming and Scripting 5 04-04-2006 01:58 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 08-25-2006
Registered User
 

Join Date: Aug 2006
Posts: 48
Whats wrong with this script?

Hi all,
Code:
#!/bin/ksh

BIN=/interface/Gunner

age=$1

directory="$2"

[ "$directory" = "" ] && directory=.

cd "$directory" || exit 1

from=`$BIN/today -$age`
cd $BIN
for i in `cat filestoarchive.txt`;do
cd $i
find . -mtime 14 | grep -v '.tar$' | $BIN/dttmfilter | awk '$1<="'$from'"{ print;};' | \
done

while read d t f
do
   [ -d $f ] && continue
   opt=u
   [ -w $d.tar ] || opt=c
   tar ${opt}f $d.tar $f && touch -r $f $d.tar && rm -f $f
done
I got this message:Syntax error at line 19 : `done' is not expected

Is it wrong to have two while statements?The first while statement grabs the files that were modified 14days ago...

Thanks
Reply With Quote
Forum Sponsor
  #2  
Old 08-25-2006
Registered User
 

Join Date: Aug 2006
Posts: 41
The first "while" is missing. Not quite sure where is your first "while" for your loop.
Reply With Quote
  #3  
Old 08-25-2006
Registered User
 

Join Date: Aug 2006
Posts: 48
followup

I have for there instead of the while. Now I fixed it. The find . -mtime should come after done NOT before.
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 11:13 PM.


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