The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-25-2006
kayarsenal kayarsenal is offline
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
  #2 (permalink)  
Old 08-25-2006
ahtat99 ahtat99 is offline
Registered User
  
 

Join Date: Aug 2006
Posts: 41
The first "while" is missing. Not quite sure where is your first "while" for your loop.
  #3 (permalink)  
Old 08-25-2006
kayarsenal kayarsenal is offline
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.
Sponsored Links
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 07:57 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