bug-bash
[Top][All Lists]
Advanced

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

Re: Changing the way bash expands associative array subscripts


From: Robert Elz
Subject: Re: Changing the way bash expands associative array subscripts
Date: Wed, 17 Mar 2021 16:37:31 +0700

    Date:        Wed, 17 Mar 2021 08:28:26 +0100
    From:        Alex fxmbsw7 Ratchev <fxmbsw7@gmail.com>
    Message-ID:  
<CAALKErGaHg-TquWGzJMt8cbwdydEhYJn75b9UNM+Z9J51ELnJw@mail.gmail.com>

  | you write like when word splitting no use double quotes
  | sure but as far as i understood:
  | key='$( faulty_command )'
  | unset -v assoc["$key"]
  | would still get expanded

associative arrays in bash are bizarre.
They're not really needed, and I'd just
avoid them.   If you're trying to do something
that is like a database, use one (sqlite,
mysql, ...).   Arrays in general aren't needed
in sh.


  | i cant get friendly'ed to builtins being
  | over keywords

I'm not sure what you mean there, keywords
win over basically everything, the things
that need to be keywords need to (if, while
etc) so the shell can implement the appropriate
syntax.  For everything else being a command,
built in or not, is better.  Thay way you can
write a function with the same name to alter
the behaviour of it if you want.  I do that
a lot, particularly with things like cd.

kre



reply via email to

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