Issues With Bash Arrays

Just figuring a few things out and writing it down for future self and anyone facing similar problems

Teri Radichel
Bugs That Bite

--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

⚙️ Check out my series on Automating Cybersecurity Metrics | Code.

🔒 Related Stories: Bugs | AWS Security | Secure Code

💻 Free Content on Jobs in Cybersecurity | ✉️ Sign up for the Email List

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

I don’t necessarily consider myself a bash expert but I feel like I am being forced to become one.

Initially I just wanted to write a POC in bash and move it to another language. But I’ve been writing this POC for like a year now…

So I’m currently working with bash arrays and it a few glitches. There are different older and newer ways to declare or use bash arrays. Many, many posts show the older ways because bash has been around so long. I’m going to stick to the newer ways because I *hope* you are not using outdated software if you are using my code for secure deployments with proper governance.

First of all, I recently discovered “local” because none of the older posts reference it. This is a very important construct because it helps you keep variables specific to a function and not overwritten by some other function that has a variable with the same name.

--

--

Teri Radichel
Bugs That Bite

CEO 2nd Sight Lab | Penetration Testing & Assessments | AWS Hero | Masters of Infosec & Software Engineering | GSE 240 etc | IANS | SANS Difference Makers Award