[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: weird problem -- path interpretted/eval'd as numeric expression

From: Greg Wooledge
Subject: Re: weird problem -- path interpretted/eval'd as numeric expression
Date: Wed, 27 Mar 2013 17:01:51 -0400
User-agent: Mutt/

On Wed, Mar 27, 2013 at 01:25:53PM -0700, Linda Walsh wrote:
> Greg Wooledge wrote:
> > Arrays cannot be exported.  The bash manual explicitly says so:
> > 
> >       Array variables may not (yet) be exported.
> ===
>       It is there for the 'yet' part. In "aliases.sh" which
> defines the 'include' function, we see:

The word "yet" in the manual simply means that a FUTURE version of bash
may be able to do so.  It does NOT mean "it will work if you write things
with a bunch of extra complexity".

> declare -A _INC
> export _INC

Associative arrays can't be exported either.

> @ line 9 in the function there is:
>   if [[ -z ${_INC["$fnc"]:-}  ]]; then
> ...
> and "$fnc" = lib/Utils/needroot.shh -- i.e. it's acting like
> it is evaluating "$fnc" without the double quotes -- and treating
> it like an integer expression.
> But _INC is a *HASH* (not a numeric) array...
> Could that be what is happening?

What makes you so sure it's an associative array at that point?  Is it
something you inherited through the environment and assumed would be
treated as an associative array even though the manual says you can't
export arrays?

Try doing "declare -p _INC" right before that, to see what bash thinks
it is.

Also, try limiting the use of -x just to specific *regions* of the code
so you can pinpoint exactly where the error is happening, since you seem
to be unsure.  Debugging the wrong chunk of code is a great way to waste
a lot of time.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]