Re: Array not defined when being set inline

2017-10-10 Thread Chet Ramey
On 10/10/17 9:06 AM, Dan Douglas wrote: > Bash parses the array assignment as though it were valid while reading > words, assignments, and redirects of the command. Because at the time the parser reads the assignment, it has to assume that it's a candidate for compound assignment. It's only whe

Re: Array not defined when being set inline

2017-10-10 Thread Greg Wooledge
On Tue, Oct 10, 2017 at 09:05:55AM -0400, shawn wilson wrote: > Nope, I knew how to correct it (as I showed in the last example), I > just figured the other two should work. "Work" how? You placed a variable in the TEMPORARY execution ENVIRONMENT of a command. You can tell it's an environment va

Re: Array not defined when being set inline

2017-10-10 Thread Dan Douglas
On 10/10/2017 07:00 AM, shawn wilson wrote: > I guess that's the right way to describe what I'm seeing: > > [swilson@localhost ~]$ unset f; f=(aaa bbb ccc) declare -p f > declare -x f="(aaa bbb ccc)" > [swilson@localhost ~]$ unset f; f=("aaa" "bbb" "ccc") declare -p f > declare -x f="(aaa bbb ccc)

Re: Array not defined when being set inline

2017-10-10 Thread shawn wilson
On Tue, Oct 10, 2017 at 8:21 AM, Greg Wooledge wrote: > On Tue, Oct 10, 2017 at 08:00:58AM -0400, shawn wilson wrote: >> I guess that's the right way to describe what I'm seeing: >> >> [swilson@localhost ~]$ unset f; f=(aaa bbb ccc) declare -p f >> declare -x f="(aaa bbb ccc)" > > You placed a str

Re: Array not defined when being set inline

2017-10-10 Thread Greg Wooledge
On Tue, Oct 10, 2017 at 08:00:58AM -0400, shawn wilson wrote: > I guess that's the right way to describe what I'm seeing: > > [swilson@localhost ~]$ unset f; f=(aaa bbb ccc) declare -p f > declare -x f="(aaa bbb ccc)" You placed a string variable in the temporary execution environment of the decl

Array not defined when being set inline

2017-10-10 Thread shawn wilson
I guess that's the right way to describe what I'm seeing: [swilson@localhost ~]$ unset f; f=(aaa bbb ccc) declare -p f declare -x f="(aaa bbb ccc)" [swilson@localhost ~]$ unset f; f=("aaa" "bbb" "ccc") declare -p f declare -x f="(aaa bbb ccc)" [swilson@localhost ~]$ unset f; f=(aaa bbb ccc) [swils