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...