Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • Are you expecting to use local Foo to remove the read-only-ness from the outer Foo variable? You can't do that. Commented Jun 14, 2024 at 7:55
  • @Kusalananda yes, that's what I'm expecting, since I can't find anything that says "-r implies globalness". Where's that documented? Commented Jun 14, 2024 at 8:13
  • declare -g at the global scope doesn't do anything interesting. The -g option is for declaring a named inside a function as global, as declare foo inside a function implicitly makes the variable local, just as if you had used local. Commented Jun 17, 2024 at 17:48