On Thu, Aug 06, 1998 at 08:11:36PM -0700, Patrick Olson wrote:
> 
> My script doesn't quite work.  Could someone tell me what I've done wrong?
> 
> The problem is that it displays the file as soon as it has a nonzero
> length. I would like the script to wait until the file is 95 bytes long.
> 
> My script:
> 
> -----
> until test -s filename
> do
>       sleep 5s
> done
> 
> cat filename
> -----
> 
Try this:
MAX=10
ITER=0

BYTES=`wc --bytes filename | awk -- '{print $1}'`
while test $BYTES -lt 95 -a $ITER -lt $MAX
do
        sleep 5s
        let ITER=ITER+1
        BYTES=`wc --bytes filename | awk -- {print $1}'`
done

cat filename
-- 
Lee Brinton | [EMAIL PROTECTED]
PGP public key @ http://www.icubed.com/~6xtippet/pgp-public-key.asc
-----------------------------------------------------------------------
Great spirits have always encountered violent opposition from
mediocre minds.
        -- Albert Einstein


--  
Unsubscribe?  mail -s unsubscribe [EMAIL PROTECTED] < /dev/null

Reply via email to