bash arrays: keys (indices) and values
This is a wiki page. Be bold and improve it!
If you have any questions about the content on this page, don't hesitate to open a new ticket and we'll do our best to assist you.
List all the elements in an array:
${my_array[@]}
List all the keys (indices) in an array:
${!my_array[@]}
Find if an index/key exist
if test "${my_array['key']+isset}"
then
echo "The key exists."
else
echo "The key does not exist."
fi