On Thu, 29 Jun 2023 08:51:58 -0400
Chet Ramey <chet.ramey@case.edu> wrote:
On 6/28/23 1:14 PM, Kerin Millar wrote:
This report is based on an observation made within the depths of this thread:
https://lists.gnu.org/archive/html/bug-bash/2023-06/msg00094.html.
Attempting to assign an array to any of the following variables with the
declare builtin causes bash to immediately exit with no diagnostic message
being issued.
BASH_ARGC
BASH_ARGV
BASH_LINENO
BASH_SOURCE
GROUPS
These are all `noassign' variables; assignments to them are ignored.
The bash debugger variables cannot be unset either. Other noassign
variables can be unset; that's why they're not readonly.
(Before you ask, noassign variables have been in bash since 1996.)
Thanks for this information. While I had no expectation of them being
assignable, some of this might have a valid place in the manual.
It does not happen if trying to assign a string.
It should be consistent, at least. I think the string assignment behavior
is the most reasonable: assignments return 1 but there's no assignment
error. I'll look at how compound assignments are different.
Thanks. I would just add that 'noassign' variables are not consistently indicated in the
manual. For example, it is said for GROUPS that "Assignments to GROUPS have no
effect" but there is no such wording for the others that I mentioned. That might be
worth addressing, even if only by inserting similarly worded sentences where appropriate.