Afficher un message
Vieux 22/08/2006, 13h20   #2
fengrui
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to skip small files in a for loop

you can use continue to skip the loop

another way to do:
if [ $size -ge 630 ]; then
echo $list
fi

"thomasriise" <thomasriise@gmail.com>
??????:1156245931.171886.305230@m79g2000cwm.google groups.com...
> I e.g. have this script:
>
> ---------------------------------
> #!/bin/ksh
>
> numfiles=`ls fil* | wc -w | sed 's/ *//'`
> files=`ls fil*`
> echo "there are $numfiles files to process"
>
> doit(){
> for i in $files
> do
> list=`ls -ut $i`
> size=`ls -lut $i 2>/dev/null | awk '{print $5}'`
> if [ $size -lt 630 ]
> then
> done
> fi
> echo $list
> done
> }
>
> doit
> ---------------------------------
>
> My shell reports that the done in line 15 is unexpected. Is there
> another way to skip the files smaller than the specified size? Or
> should I just do that before the loop should begin?
>
> Thanks.
>



  Réponse avec citation
 
Page generated in 0,05481 seconds with 9 queries