On 2/23/20 11:36 AM, pepa65 wrote:
> On 23/02/2020 23.27, Chet Ramey wrote:
>> On 2/21/20 3:31 AM, pepa65 wrote:
>>> By the way, it seems that `local -p var` doesn't work like 'declare -p
>>> var` even though `help local` suggests it should.
>>
>> How so? Do you mean that declare -p var in a functi
On 23/02/2020 23.27, Chet Ramey wrote:
> On 2/21/20 3:31 AM, pepa65 wrote:
>> By the way, it seems that `local -p var` doesn't work like 'declare -p
>> var` even though `help local` suggests it should.
>
> How so? Do you mean that declare -p var in a function will show different
> variables?
See
On 2/21/20 3:31 AM, pepa65 wrote:
> On 21/02/2020 02.37, Chet Ramey wrote:
>> It's unset because it doesn't have a value, but it retains the `local'
>> attribute so it stays local if subsequently assigned one.
>
> Is there any reason the local attribute cannot be unset? If it would be
> possible t
On 21/02/2020 02.37, Chet Ramey wrote:
> It's unset because it doesn't have a value, but it retains the `local'
> attribute so it stays local if subsequently assigned one.
Is there any reason the local attribute cannot be unset? If it would be
possible then the "declare/typeset -p" would return 1
> On Thu, 20 Feb 2020, Chet Ramey wrote:
> On 2/20/20 10:05 AM, Ulrich Mueller wrote:
>>> On Thu, 20 Feb 2020, pepa65 wrote:
>>
>>> On 20/02/2020 19.48, Ulrich Mueller wrote:
Still, I think it's sad that there isn't a command that can test for
assigned vs void variable, without
On 2/20/20 10:05 AM, Ulrich Mueller wrote:
>> On Thu, 20 Feb 2020, pepa65 wrote:
>
>> On 20/02/2020 19.48, Ulrich Mueller wrote:
>>> Still, I think it's sad that there isn't a command that can test for
>>> assigned vs void variable, without the need for parsing of declare -p
>>> output.
>
>>
On Thu, Feb 20, 2020 at 04:05:01PM +0100, Ulrich Mueller wrote:
> > On Thu, 20 Feb 2020, pepa65 wrote:
>
> > On 20/02/2020 19.48, Ulrich Mueller wrote:
> >> Still, I think it's sad that there isn't a command that can test for
> >> assigned vs void variable, without the need for parsing of decl
> On Thu, 20 Feb 2020, pepa65 wrote:
> On 20/02/2020 19.48, Ulrich Mueller wrote:
>> Still, I think it's sad that there isn't a command that can test for
>> assigned vs void variable, without the need for parsing of declare -p
>> output.
> There is no need to parse, the return value of `decla
On 20/02/2020 19.48, Ulrich Mueller wrote:
> Still, I think it's sad that there isn't a command that can test for
> assigned vs void variable, without the need for parsing of declare -p
> output.
There is no need to parse, the return value of `declare -p var` or
`typeset -p var` will tell you what
> On Wed, 19 Feb 2020, Stephane Chazelas wrote:
> 2020-02-19 17:18:14 +0100, Ulrich Mueller:
> [...]
>> So, is there any syntax that allows to test if a value has been assigned
>> to the array variable? Especially, to distinguish VARNAME=() (empty
>> array) from VARNAME being unset?
> [...]
>
On Wed, Feb 19, 2020 at 11:38 AM Ulrich Mueller wrote:
> Especially, to distinguish VARNAME=() (empty
> array) from VARNAME being unset?
I'm not sure if it's intended to work this way, but ${var@a} will
report the attributes if the variable has any set, even if it does not
have a value, like:
2020-02-19 17:18:14 +0100, Ulrich Mueller:
[...]
> So, is there any syntax that allows to test if a value has been assigned
> to the array variable? Especially, to distinguish VARNAME=() (empty
> array) from VARNAME being unset?
[...]
You could do:
if typeset -p var 2> /dev/null | grep -q '='; th
On 2/19/20 11:18 AM, Ulrich Mueller wrote:
>> On Wed, 19 Feb 2020, Chet Ramey wrote:
>
>> On 2/19/20 7:00 AM, Ulrich Mueller wrote:
>>> Bash Version: 5.0
>>> Patch Level: 16
>>> Release Status: release
>>>
>>> Description:
>>> The GNU Bash Reference Manual Version 5.0 says about test -v:
>>> '
On 19/02/2020 23.18, Ulrich Mueller wrote:
> So, is there any syntax that allows to test if a value has been assigned
> to the array variable? Especially, to distinguish VARNAME=() (empty
> array) from VARNAME being unset?
Not `test` as such as we have just learned, but the returncode of
`declare
> On Wed, 19 Feb 2020, Chet Ramey wrote:
> On 2/19/20 7:00 AM, Ulrich Mueller wrote:
>> Bash Version: 5.0
>> Patch Level: 16
>> Release Status: release
>>
>> Description:
>> The GNU Bash Reference Manual Version 5.0 says about test -v:
>> '-v VARNAME'
>> True if the shell variable VARNAME is
On 2/19/20 7:00 AM, Ulrich Mueller wrote:
> Bash Version: 5.0
> Patch Level: 16
> Release Status: release
>
> Description:
> The GNU Bash Reference Manual Version 5.0 says about test -v:
> '-v VARNAME'
>True if the shell variable VARNAME is set (has been
>assig
16 matches
Mail list logo