bug-bash
[Top][All Lists]
Advanced

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

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


From: Linda Walsh
Subject: Re: weird problem -- path interpretted/eval'd as numeric expression
Date: Wed, 27 Mar 2013 14:37:16 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666


Greg Wooledge wrote:
> 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.
---
        Yeah, but they seem to get propagated anyway, I must save it somewhere 
like
I do _FPATH... i.e. each include adds teh included script into the INC array so
I don't
try to re-include it.

Note after I change the PATH, the _FPATH array is automatically updated as well

Ishtar:law> include stdalias.shh
declare -Ax _INC='()'
declare -ax _FPATH='([0]="." [1]="/sbin" [2]="/usr/local/sbin"
[3]="/home/law/bin" [4]="/usr/local/bin" [5]="/usr/bin" [6]="/bin"
[7]="/usr/bin/X11" [8]="/usr/X11R6/bin" [9]="/usr/games" [10]="/opt/kde3/bin"
[11]="/usr/lib/mit/bin" [12]="/usr/lib/mit/sbin" [13]="/opt/dell/srvadmin/bin"
[14]="/usr/sbin" [15]="/home/law/bin/lib" [16]="/etc/local/func_lib"
[17]="/home/law/lib")'

Ishtar:law> PATH=~/bin/lib:$PATH
Ishtar:law> include stdlib.shh
declare -Ax _INC='([stdalias.shh]="/home/law/bin/lib/stdalias.shh" )'
declare -ax _FPATH='([0]="/home/law/bin/lib" [1]="." [2]="/sbin"
[3]="/usr/local/sbin" [4]="/home/law/bin" [5]="/usr/local/bin" [6]="/usr/bin"
[7]="/bin" [8]="/usr/bin/X11" [9]="/usr/X11R6/bin" [10]="/usr/games"
[11]="/opt/kde3/bin" [12]="/usr/lib/mit/bin" [13]="/usr/lib/mit/sbin"
[14]="/opt/dell/srvadmin/bin" [15]="/usr/sbin" [16]="/home/law/bin/lib"
[17]="/etc/local/func_lib" [18]="/home/law/lib")'


# I execute a 2nd bash, but notice -- INC and FPATH were both propagated to the
child and both
#  are of the correct type

(so guess that wasn't an explanation)

Unfortunately, if I try to include needroot, it tries to re-exec the original
program, which
doesn't work so well in an interactive shell... ;-)


Ishtar:law> bash
User law's .bashrc called 2nd time
Ishtar:law> include stdlib.shh
declare -Ax _INC='([stdlib.shh]="/home/law/bin/lib/stdlib.shh"
[stdalias.shh]="/home/law/bin/lib/stdalias.shh" )'
declare -ax _FPATH='([0]="/home/law/bin/lib" [1]="." [2]="/sbin"
[3]="/usr/local/sbin" [4]="/home/law/bin" [5]="/usr/local/bin" [6]="/usr/bin"
[7]="/bin" [8]="/usr/bin/X11" [9]="/usr/X11R6/bin" [10]="/usr/games"
[11]="/opt/kde3/bin" [12]="/usr/lib/mit/bin" [13]="/usr/lib/mit/sbin"
[14]="/opt/dell/srvadmin/bin" [15]="/usr/sbin" [16]="/home/law/bin/lib"
[17]="/etc/local/func_lib" [18]="/home/law/lib")'
declare -Ax _INC='([stdlib.shh]="/home/law/bin/lib/stdlib.shh"
[stdalias.shh]="/home/law/bin/lib/stdalias.shh" )'
declare -ax _FPATH='([0]="/home/law/bin/lib" [1]="." [2]="/sbin"
[3]="/usr/local/sbin" [4]="/home/law/bin" [5]="/usr/local/bin" [6]="/usr/bin"
[7]="/bin" [8]="/usr/bin/X11" [9]="/usr/X11R6/bin" [10]="/usr/games"
[11]="/opt/kde3/bin" [12]="/usr/lib/mit/bin" [13]="/usr/lib/mit/sbin"
[14]="/opt/dell/srvadmin/bin" [15]="/usr/sbin" [16]="/home/law/bin/lib"
[17]="/etc/local/func_lib" [18]="/home/law/lib")'




reply via email to

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