[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [K12OSN] OT Help with file deletion script



On Thu, 2007-10-25 at 10:16 -0500, Jim Kronebusch wrote:
> On Thu, 25 Oct 2007 02:50:27 -0400, Terrell Prudé Jr. wrote
> > Here's a modification that might make it actually run.  Std. "no
> > guarantees" caveat applies.
> > 
> > #!/bin/sh
> > cd /home
> > for userdir in `ls -C1`
> > do
> >   echo Working on $userdir...
> >   cd $userdir
> >   for deleteme in `ls -C1 -a`
> >   do
> >     if [[ $deleteme != 'mail' ]] || [[ $deleteme != '.openwebmail' ]]
> >     then do
> >       echo Removing $deleteme...
> >       rm -ri $deleteme
> >     done
> >     else echo "Oops, encountered "$deleteme", not deleting!"
> >     fi
> >   done
> > done
> 
> I get this error when run:
> 
> ./homedir_purge: 10: Syntax error: "do" unexpected
> 
> Ideas?

Remove the "do" from line 10 and the "done" from line 13. The
if ...
then
.
.
.
else
.
.
fi

is sufficient grouping.
> 
> Jim
> 
> -- 
> This message has been scanned for viruses and
> dangerous content by the Cotter Technology 
> Department, and is believed to be clean.
> 
> _______________________________________________
> K12OSN mailing list
> K12OSN redhat com
> https://www.redhat.com/mailman/listinfo/k12osn
> For more info see <http://www.k12os.org>
> 
-- 
James P. Kinney III          
CEO & Director of Engineering 
Local Net Solutions,LLC        
770-493-8244                    
http://www.localnetsolutions.com

GPG ID: 829C6CA7 James P. Kinney III (M.S. Physics)
<jkinney localnetsolutions com>
Fingerprint = 3C9E 6366 54FC A3FE BA4D 0659 6190 ADC3 829C 6CA7

Attachment: signature.asc
Description: This is a digitally signed message part


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]