On Tue, 13 Feb 2024 00:07:47 +0100 alex xmb sw ratchev <fxmb...@gmail.com> wrote:
> On Mon, Feb 12, 2024, 23:25 Koichi Murase <myoga.mur...@gmail.com> wrote: > > > 2024年2月13日(火) 6:13 Chet Ramey <chet.ra...@case.edu>: > > > Only for indexed and associative arrays, since those are the attributes > > > that cause changes in the underlying value storage format. That's > > different > > > than turning the integer attribute on and off, for instance. > > > > > > Should it be an actual error, or should the shell just cancel out the > > > attribute change requests and go on? What do folks think? > > > > I think it can be a usage error; it doesn't do anything on the > > variable (i.e. doesn't make it an associative array) and outputs an > > error message. > > > > isnt the gnu style , excepts defined cases , last used is active That's not quite accurate. GNU does not directly mention any such style. https://www.gnu.org/prep/standards/html_node/Command_002dLine-Interfaces.html#Command_002dLine-Interfaces Still, GNU begins by recommending that the "POSIX guidelines" be followed (in typical GNU fashion, not clearly referencing the source material). As such, here are the current "Utility Conventions". https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html There, the 11th guideline states: "The order of different options relative to one another should not matter, unless the options are documented as mutually-exclusive and such an option is documented to override any incompatible options preceding it. If an option that has option-arguments is repeated, the option and option-argument combinations should be interpreted in the order specified on the command line." So, it expresses a preference for the last specified, mutually exclusive option winning, _provided_ that it is documented to that effect. For that matter, +A does not qualify as an option in their parlance. In any case, it is a guideline, not an edict. It doesn't seem to me to be a compelling argument against having the declare builtin treat an illogical request as a usage error. -- Kerin Millar