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. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/