[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Found problem mentioned in email 3/27: path interpretted/eval'd as n
From: |
Linda Walsh |
Subject: |
Re: Found problem mentioned in email 3/27: path interpretted/eval'd as numeric expression |
Date: |
Thu, 18 Apr 2013 17:31:19 -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 |
Chris Down wrote:
> On 2013-04-17 17:30, Linda Walsh wrote:
>> BTW, is it planned to implement exporting ARRAY and HASHES?
>>
>> Sure would simplify some programs... ;-)
>
> As if exporting functions wasn't hacky enough...
----
But then the function would have produced consistent
results ... i.e. exporting a function w/o it's data requires
more complicated workarounds.
You can export ARRAYS and aliases, with special handling...
---
In my bashenv...
shopt -s extglob
f="${-//*([^x])/}"; [[ $f ]] && set +x
[[ -n ${_GPSAFE_:-""} ]] 2>/dev/null && eval "$_GPSAFE_"
[[ ${__GLOBAL_ALIASES__:-} ]] && eval "$__GLOBAL_ALIASES__"
[[ ${__INHERIT_ALIASES__:-} ]] && eval "$__INHERIT_ALIASES__"
[[ $f ]] && set -x
----
The only one I use is _GPSAFE_, a hash, _GROUPS_, mapping groupnames->gid...
_GPSAFE_ is a stringified version of the hash (output of typeset -p _GROUP_).
So I can check for group membership by name.
> echo ${_GROUPS_[Domain Admins]}
512
I can call 'sudo' based on group membership (assuming the sudo config
and the array are in agreeance) or return a message that they
need to be root to do xxyz...
Like I said though, it would simplify things if arrays, hashes and aliases
were *able* to be exported natively...