A little background:
So recently I was working a project where I had to implement some new features. The project was primarily written in BASH. While I love BASH it’s for simpler tasks, or at least this is what I thought.
What is an Associative array:
In computer science, an associative array, map, symbol table, or dictionary is an abstract data type composed of a collection of (key, value) pairs, such that each possible key appears at most once in the collection.
I’ve used associative arrays in different projects when I had to work with PHP, Python, and other languages but never with BASH, I didn’t even know it was possible.
In this mini-tutorial, I’ll go over exactly that, associative arrays in BASH, how to control, populate it, how to define and use them.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $100 of credit to try our products over 60 days!