Skip to content

Instantly share code, notes, and snippets.

@tuananh
Last active February 3, 2024 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tuananh/d668fe8c71ad2b50815f0c025f3149f3 to your computer and use it in GitHub Desktop.
Save tuananh/d668fe8c71ad2b50815f0c025f3149f3 to your computer and use it in GitHub Desktop.
declare -A -r my_hashmap=(
["foo"]="bar"
["baz"]="qux"
)
echo "${my_hashmap["foo"]}"
for key in "${!my_hashmap[@]}"; do
echo "key: $key, val: ${my_hashmap[$key]}"
done
# key: foo, val: bar
# key: baz, val: qux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment