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

Re: Fwd: how to check 400 files exist



On Thu, Jan 19, 2012 at 01:32:12AM +0800, lina wrote:
>    Sorry to send to Darac, here forwards to list. 
>    Begin forwarded message:
> 
>      From: lina <[1]lina.lastname@gmail.com>
>      Date: 19 January, 2012 1:29:14 GMT+08:00
>      To: Darac Marjal <[2]mailinglist@darac.org.uk>
>      Subject: Re: how to check 400 files exist
> 
>      On 19 Jan, 2012, at 1:09, Darac Marjal <[3]mailinglist@darac.org.uk>
>      wrote:
> 
>        The problem you have here is that you don't know when a file isn't
>        there. Try:
> 
>        Missing=0
>        for i in $(seq 5); do
>         if [ ! -e sys_em_$i.txt ]; then
>            Missing=1
>         fi
>        done
>        if [ $Missing -eq 1 ]; then
>         print "One or more files is missing!
> 
>    Thanks, how can I return to check after sleep 10 seconds ?

Missing=1    # Start by assuming failure
             # This means we run the loop AT LEAST once
while [ $Missing -eq 1 ]; do
   for ...
      if ...
	  fi
   done
   sleep 10
done
print "If we got here, Missing is 0. Cushty!"


-- 
Darac Marjal


Reply to: