Hi!

----

Another issue with compound variables:
If I initalise a compound variable like this:
-- snip --
typeset filename="/foo/bar"
# codepath 1:
typeset scan=(
        typeset -A records=(
                [${filename}]=(
                        typeset filename="$filename"
                )
        )
)

print -r -- "$scan"
-- snip --
... then I get a "test: line 3: /foo/bar: arithmetic syntax error"
because "[${filename}]=" is interpreted as arithmetric expression.

Seperating the initalisation for "records" into a standalone assignment
fixes the problem:
-- snip --
typeset filename="/foo/bar"

# codepath 2:
typeset scan=(
        typeset -A records
)

scan.records=(
        [${filename}]=(
                typeset filename="$filename"
        )
)

print -r -- "$scan"
-- snip --

The output is then (AFAIK correctly):
-- snip --
(
        typeset -A records=(
                [/foo/bar]=(
                        filename=/foo/bar
                )
        )
)
-- snip --

AFAIK the "arithmetic syntax error" for codepath 1 is a bug, right ?

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [EMAIL PROTECTED]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
_______________________________________________
ast-developers mailing list
[email protected]
https://mailman.research.att.com/mailman/listinfo/ast-developers

Reply via email to