Re: Bash – $(( )) vs. $[]

Johnny Rosenberg gurus.knugum at gmail.com
Tue Dec 4 17:46:14 UTC 2012


2012/12/4 Tony Arnold <tony.arnold at manchester.ac.uk>:
> Johnny,
>
> On 03/12/12 19:14, Johnny Rosenberg wrote:
>
>>> On Mo, 2012-12-03 at 18:02 +0100, Johnny Rosenberg wrote:
>>>> ~$ a=3
>>>> ~$ b=4
>>>> ~$ echo $(($a+$b))
>
> As an aside, you don't need the $ symbols to indicate variables inside
> the (( )). So the following works too:
>
> echo $((a+b))
>
> This also works using [] thus
>
> echo $[a+b]

Thanks! I'll remember that!


Kind regards

Johnny Rosenberg
ジョニー・ローゼンバーグ


>
> Regards,
> Tony.--
> Tony Arnold,                        Tel: +44 (0) 161 275 6093
> Head of IT Security,                Fax: +44 (0) 705 344 3082
> University of Manchester,           Mob: +44 (0) 773 330 0039
> Manchester M13 9PL.                 Email: tony.arnold at manchester.ac.uk
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users




More information about the ubuntu-users mailing list