bug-bash
[Top][All Lists]
Advanced

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

Re: Bug/limitation in 'time'


From: Chris Down
Subject: Re: Bug/limitation in 'time'
Date: Sun, 17 Mar 2013 10:35:23 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On 2013-03-16 19:33, Bruce Dawson wrote:
> Thanks -- good to know that there is a fast and POSIX compliant method of
> doing this. I should have included my optimized counting loop -- it's what
> we switched to when we realized that $(expr) was a problem. Here it is now:
>
> # This code performs quite well
> function BashCount() {
>       i=$1
>       while [ $i -gt 0 ]; do
>               (( i-- ))
>       done
>       echo Just did $1 iterations using bash math
> }
> time BashCount 150000

For the record `function' and `((' are not POSIX.

Chris



reply via email to

[Prev in Thread] Current Thread [Next in Thread]