[CentOS] [OT] Bash help

Wed Oct 25 19:34:12 UTC 2017
Warren Young <warren at etr-usa.com>

On Oct 25, 2017, at 11:28 AM, Mark Haney <mark.haney at neonova.net> wrote:
> 
> An associative array was the first thing I thought of, then realized BASH doesn't do those.

But it does: in Bash 4, only.

If you mean you must still use Bash 3 in places, then yeah, you’ve got a problem… one probably best solved by switching to some other language once the program grows beyond Bash 3’s natural scope.

I was trying to think of which languages I know well which require even more difficult solutions than the Bash 4 one.  It’s a pretty short list: assembly, C, and MS-DOS batch files.  By “C” I’m including anything of its era and outlook: Pascal, Fortran…

I think even Tcl beats Bash 4 on this score, and it’s notoriously minimal in its feature set.

Here’s a brain-bender: You could probably do it with sqlite3 with fewer lines of code than my Bash 4 offering. :)

> I honestly expected there to be a fairly straight forward way to do it in BASH, but I was sadly mistaken.

Oh, I don’t know, there must be a way to do it without associative arrays, but you’d only get points for the masochism value in doing without.