bash array

bash arrays: keys (indices) and values

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

Syndicate content