[Linux-programlama] bashte integer expression expected hatasi

---------

New Message Reply About this list Date view Thread view Subject view Author view Attachment view

From: Ali Metin (siyisoy@hotmail.com)
Date: Sun 26 Mar 2006 - 23:16:30 EEST


#! /bin/bash
counter=0
for index in *

do
echo "File " $index
let "counter +=1"
if [ "$counter" -gt 50 ]
       then
       #mv $index ../
       ti=`ls -l $index | awk '{ print $5 }'`

       top=`expr $top+$ti`

       if [ "$top" -gt 660000 ]
       then
       #mv $index cd$p/
       echo $p $top
       $top=0
       (($p+=1))
       fi
fi
done
echo "sayi" $counter $ti

Yukaridaki scriptte bir kalsordeki dosyalarin uzunluklarina gore farkli alt
klasorlere toplamak istiyorum. Sonucta alt klasorlerdeki dosyalar cdye
yazilmaya hazir hale gelecek. 660000 sayisi da bir cd nin kapasitesini
temsil ediyor. Bu islemi yaparken top=`expr $top+$ti` ifadesinde top
numeric bir degisken fakat ti alfanumeric olarak algilandigi icin toplama
islemi gerceklesmiyor. Burada ti o dosyanin boyutu. Arastirdim ama
alfanumeric2numeric cevrimini bulamadim.Bunu nasil yapabilirim?

_______________________________________________
Linux-programlama mailing list
Linux-programlama@liste.linux.org.tr
http://liste.linux.org.tr/mailman/listinfo/linux-programlama


New Message Reply About this list Date view Thread view Subject view Author view Attachment view

---------

Bu arsiv hypermail 2.1.2 tarafindan uretilmistir.