i tried as i said array stuff by declare -p i tried to do the following thing without loop only with string assignments but failed cause cutment is not so my thing, rather extractments
cat functions/assoc2arr declare dest=$1 cont=( "${@:2}" ) i=-1 src key res set -- while [[ -v cont[++i] ]] && src=${cont[i]} ; do declare -n _src=$src for key in "${!)src[@]}" ; do res+=\ ${key@Q} done done declare -ga "${dest:-arr}=\($res\)" On Thu, Mar 18, 2021 at 4:03 PM Alex fxmbsw7 Ratchev <fxmb...@gmail.com> wrote: > i also wanna say > no extraction method is no good for a coding language ( no extraction as > is only minus ( substraction ) is possible but no .. ) > why dont you just enable backreferences \<number> of match > for ${var/ and // > and impent a regex variant, as you do by [[ =~ anyway > > On Thu, Mar 18, 2021 at 4:00 PM Alex fxmbsw7 Ratchev <fxmb...@gmail.com> > wrote: > >> as for goal, and no believance, it is handling quoting, string issues, >> nothing else >> you may know if you think about it im a freelance code there is nothing >> now but major functionality issues >> .. >> >> On Thu, Mar 18, 2021 at 3:57 PM Alex fxmbsw7 Ratchev <fxmb...@gmail.com> >> wrote: >> >>> what, dude, of course you can regex eerything right >>> that is, for no quotes >>> till non escaped end, ] probably >>> for " its till nonescaped " >>> and for $' till nonescaped ' >>> >>> i can regex it or extglob it >>> hm ? >>> but i need the results of grouping of the matches ( '( .. )' ) >>> >>> On Thu, Mar 18, 2021 at 3:39 PM Greg Wooledge <g...@wooledge.org> wrote: >>> >>>> On Thu, Mar 18, 2021 at 02:44:06PM +0100, Alex fxmbsw7 Ratchev wrote: >>>> > isnt it obvious .. >>>> >>>> No. >>>> >>>> > ${var//@(abc|cde)@(bla|blubb)/\2\1} # just like sed >>>> > and an extension for regex there >>>> >>>> That's a feature request. Chet can discuss that with you. >>>> >>>> All I can tell you is that this feature is not in any way suitable for >>>> retrieving an element from an associative array. If it actually >>>> existed, >>>> which of course it doesn't. >>>> >>>> > as for example, i can give you my garbage data >>>> > >>>> > begin='declare -A a' end='declare -p a' per2 'a[$per]=' * >>>> > declare -A a=(["\\\\"]="" ["] \$( eval echo shitt )"]="" [$'abc >>>> > \034[22]="bar"']="" [$'\034']="" [$'\n']="" [2]="" ["]"]="" [" a >>>> b"]="" >>>> > ["' [b"]="" ["\" ["]="" [$'\' [1]=\034']="" ["];eval echo shitt"]="" >>>> > [$'foo\034 [2]="blah" ']="" [abc]="" ["abc [22]=\"bar\""]="" >>>> [blah]="" ) >>>> >>>> I cannot make ANY sense of this. I don't know what you're doing or why. >>>> >>>> Whatever you're doing, it's ridiculously convoluted and obscure. There >>>> is probably some MUCH easier way to achieve the goal. If you would just >>>> tell us the goal, we might be able to help you do it. >>>> >>>>