bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Array not defined when being set inline


From: shawn wilson
Subject: Re: Array not defined when being set inline
Date: Tue, 10 Oct 2017 09:05:55 -0400

On Tue, Oct 10, 2017 at 8:21 AM, Greg Wooledge <address@hidden> 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:
>>
>> address@hidden ~]$ 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 declare command.  If you wanted an actual array variable that would
> persist past this command, you need a semicolon or newline after the
> assignment, and before the declare command.
>

Nope, I knew how to correct it (as I showed in the last example), I
just figured the other two should work.

>
> See also: http://mywiki.wooledge.org/BashFAQ/104

Thanks for that (and the link it provides to BashParser - I'm going to
have to digest that).

Is there a way to detect that the parser has already processed a
temporary variable and maybe change the exit status or something?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]