分页: 1 / 1

每2秒循环问题

发表于 : 2011-03-05 19:59
liucheng1513
如何用循环让下列语句每2秒执行一次
cd /home/work/dl_stat
ls *.log|while read i;
do
temp=`echo $i|cut -c 36-37` ;
if [ $temp -lt 13 ] && [ $temp -gt 8 ] ;then
echo $i;
newname=${i:0:22}1${i:23} ;
echo $newname;
mv $i $newname;
fi;
done;


——————————————————————————————————————————————————————————
自己下了个,感觉不对,哪位帮改改!
#! /bin/bash
i=30;while ((i != 0));
do
cd /home/work/dl_stat
ls *.log|while read i;
do
temp=`echo $i|cut -c 36-37` ;
if [ $temp -lt 13 ] && [ $temp -gt 8 ] ;then
echo $i;
newname=${i:0:22}1${i:23} ;
echo $newname;
mv $i $newname;
fi;
done;
((i--));
sleep 2;
done

Re: 每2秒循环问题

发表于 : 2011-03-06 9:40
sk1418
不对说什么错?

最后一个 done后面应该有分号吧? copy的问题? :em09