bug-bash
[Top][All Lists]
Advanced

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

RE: Bug/limitation in 'time'


From: Bruce Dawson
Subject: RE: Bug/limitation in 'time'
Date: Sun, 17 Mar 2013 21:37:50 -0700

Chris Down pointed that out. My loop now looks like this -- portable (I
believe) and fast:

BashCount() {
    for (( i = $1 ; i > 0 ; i-- )); do
        :
    done
    echo Just did $1 iterations using bash math
}

-----Original Message-----
From: Linda Walsh [mailto:address@hidden 
Sent: Sunday, March 17, 2013 8:36 PM
To: Bruce Dawson
Cc: 'Chris Down'; address@hidden; address@hidden
Subject: Re: Bug/limitation in 'time'



Bruce Dawson wrote:
> Yep, we've changed our loops to use roughly that syntax. Unfortunately 
> a lot of online resources recommend the $(expr) technique. My 
> understanding is that using $(expr) is more portable, because i-- is 
> bash specific, but I don't really know.

but $((i-=1)) isn't Bash specific and does the same thing...




reply via email to

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