Re: [Help-bash] Can `declare -i` increase the performance of integer ari
From:
Pierre Gaston
Subject:
Re: [Help-bash] Can `declare -i` increase the performance of integer arithmetic?
Date:
Mon, 22 Jan 2018 16:28:24 +0200
On Mon, Jan 22, 2018 at 3:48 PM, Peng Yu <address@hidden> wrote:
> > No, it's not meant to improve performance.
>
> Then, what is the purpose of `declare -i`?
>
> --
> Regards,
> Peng
>
>
It can save you a couple of $(( )):
declare -i sum
sum=2+3
echo $sum # prints 5
sum+=1
echo $sum # prints 6