Dynamic variable failure & equiv-const strings compare unequal

2015-10-22 Thread Linda Walsh
Greg Wooledge wrote: Also I think you are completely misrepresenting the dynamic variable scope system that bash uses. Variables are not just global or local. There's an entire stack of them. When you reference a variable (let's say i) inside a function, bash searches up through the

Re: Dynamic variable failure & equiv-const strings compare unequal

2015-10-22 Thread Linda Walsh
Oleg Popov wrote: On Thu, Oct 22, 2015 at 03:01:06AM -0700, Linda Walsh wrote: [cut] I.e. test output was: Case 2 got/Expected: "222" "1\ 222\ .3\ .4" [cut] You didn't initialize the array. By the time you do "parts[1]=222" it's still empty. And in your previous message you tried to

Re: Dynamic variable failure & equiv-const strings compare unequal

2015-10-22 Thread Chet Ramey
On 10/22/15 8:13 AM, Linda Walsh wrote: > > > Oleg Popov wrote: >> On Thu, Oct 22, 2015 at 03:01:06AM -0700, Linda Walsh wrote: >>> [cut] >>> I.e. test output was: >>> Case 2 got/Expected: >>> "222" >>> "1\ 222\ .3\ .4" >>> [cut] >> >> You didn't initialize the array. By the time you do

Re: Dynamic variable failure & equiv-const strings compare unequal

2015-10-22 Thread Linda Walsh
Oleg Popov wrote: $(...) is a subshell. Variables cannot be passed back from a subshell, no matter how and where they are declared. --- Um... oh.. in testor, still calling that way. I missed that. This is even more annoying for passing back results than I thought. Grrr.

Re: Dynamic variable failure & equiv-const strings compare unequal

2015-10-22 Thread Oleg Popov
On Thu, Oct 22, 2015 at 03:01:06AM -0700, Linda Walsh wrote: > [cut] > I.e. test output was: > Case 2 got/Expected: > "222" > "1\ 222\ .3\ .4" > [cut] You didn't initialize the array. By the time you do "parts[1]=222" it's still empty. And in your previous message you tried to initialize it in

Re: Dynamic variable failure & equiv-const strings compare unequal

2015-10-22 Thread Oleg Popov
On Thu, Oct 22, 2015 at 05:13:45AM -0700, Linda Walsh wrote: > Oleg Popov wrote: > > On Thu, Oct 22, 2015 at 03:01:06AM -0700, Linda Walsh wrote: > >> [cut] > >> I.e. test output was: > >> Case 2 got/Expected: > >> "222" > >> "1\ 222\ .3\ .4" > >> [cut] > > > > You didn't initialize the array. By