3 ms·
One thing the article doesn't mention is how you can use indirect expansion to get a list of all keys. For example: `${!myvar[@]}` would list all of the keys.
by nickjj 2y ago
One thing the article doesn't mention is how you can use indirect expansion to get a list of all keys.
For example: `${!myvar[@]}` would list all of the keys.
I've written about associative arrays in Bash a bit here: https://nickjanetakis.com/blog/associative-arrays-in-bash-aka-key-value-dictionaries https://nickjanetakis.com/blog/associative-arrays-in-bash-ak...
- singularity2001 2y agodoesn't work in zsh?
- nickjj 2y agoIt doesn't but if you're putting this into a script that's ok. You can set the script's shebang to bash so even if your user's shell is using zsh, the script will run with bash.