On Fri, Sep 23, 2005, Stuart Shelton wrote:

> >As (1) both OpenPKG and non-OpenPKG Bash, (2) both old and new versions
> >of Bash and (3) the error does not exists on other platforms, I would
> >say: yes, Bash is broken on your IRIX64 platform.
> >
> >For me it looks that it already incorrectly _parses_ (and not just
> >evaluates) the $((..)) construct. The problem you can just hunt down
> >by using a debugger or at least instrumenting Bash with many debugging
> >printf's.
>
> Fair enough - but before I go hunting down a (potentially) phantom bug,
> could someone just confirm that my syntax is right in the first place ;)
>
> Someone suggested that "A=$(( 3 + 4 ))" should evaluate as "A=$7" - but I
> think this is most likely wrong (as trying to execute "3" doesn't make
> sense in this context).
>
> *Should* "A=$(( 3 + 4 ))" result in A having value 7?

Yes, of course.

> Is "A=$(( 3 + 4 ))" synonomous with "(( A = 3 + 4 ))"?

No, the $((..)) construct is an arithmetic expression in Bash. The
result has to be A=7 and this is actually the case on all platforms I've
available:

| $ for h in rm0 rm1 rm2 rm3 rm4 rm5 rm6 rm7 rm8 rm9 vm10 vm11 vm12 vm20 vm21 
vm22 vm30 vm31 vm32; do \
|       ssh $h "/usr/opkg/bin/bash -c '/usr/opkg/bin/openpkg rpm --eval 
%{l_platform}; A=\$(( 3 + 4 )); echo A=\$A'"; \
|   done
| ix86-freebsd5.4
| A=7
| ix86-solaris10
| A=7
| ix86-debian3.1
| A=7
| ix86-rhel3
| A=7
| ix86-solaris9
| A=7
| ia64-freebsd5.4
| A=7
| amd64-freebsd5.4
| A=7
| sparc64-solaris9
| A=7
| sparc64-solaris8
| A=7
| sparc64-solaris10
| A=7
| ix86-freebsd6.0
| A=7
| ix86-netbsd2.0.2
| A=7
| ix86-gentoo1.12.0
| A=7
| ix86-suse9.3
| A=7
| ix86-mandriva10.2
| A=7
| ix86-freebsd4.11
| A=7
| ix86-fedora4
| A=7
| ix86-suse10.0
| A=7
| ix86-freebsd7.0
| A=7

As you can see, the construct works as expected with OpenPKG 2.4's
"bash" on a large set of different platforms. So, it has to be a local
IRIX problem you are faced with.

                                       Ralf S. Engelschall
                                       [EMAIL PROTECTED]
                                       www.engelschall.com

______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
Developer Communication List                   openpkg-dev@openpkg.org

Reply via email to