bug-bash
[Top][All Lists]
Advanced

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

Re: inconsistency with "readonly" and scope


From: dethrophes
Subject: Re: inconsistency with "readonly" and scope
Date: Wed, 11 Apr 2012 22:12:12 +0200
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:11.0) Gecko/20120327 Thunderbird/11.0.1

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



reply via email to

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