Am 11.04.2012 20:50, schrieb Greg Wooledge:
"declare" when used in a function acts like "local", and creates a variable
with scope local to that function. So does "declare -r". But "readonly",
which is otherwise the same as "declare -r", creates variables with global
scope.
Is this intended?
Tested with 2.05b, 3.something, and 4.2.20.
I've also noticed weird behavior with "declare -gr" the r sometimes
seems to override the g, but not specific to functions It seems to be
specific either to the source file or to the compound statement. I
haven't been able to figure out exactly whats going on there. I haven't
been able to reproduce it in a simple example. this is most readily
noticeable with set -o nounset