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:[email protected]]
Sent: Sunday, March 17, 2013 8:36 PM
To: Bruce Dawson
Cc: 'Chris Down'; [email protected]; [email protected]
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...