On 4/27/15 2:26 AM, isabella parakiss wrote:
> On 4/27/15, Chet Ramey <[email protected]> wrote:
>> On 4/26/15 5:26 PM, isabella parakiss wrote:
>>> $ fn () { declare -g var=x; declare -p var; } ; fn
>>> declare -- var="x"
>>>
>>> I think the correct output should be declare -g var="x"
>>> Is this intended or is it a bug?
>>
>> There is no such thing as `the global attribute'. The -g option simply
>> causes declare to create variables at the global scope instead of in a
>> function-local scope. The output you see is no different than what
>> would have been displayed had `var' been declared and given a value at
>> the global scope outside the function.
>>
>
> Ok I understand, but would it be possible to add it?
It really doesn't make sense.
Since you're writing your file once, why not just grep the output
of `set'? That will give you proper quoting without the `declare'.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/