Skip to content

Instantly share code, notes, and snippets.

@shkitch

shkitch/bash-arrays.sh

Last active Feb 17, 2017
Embed
What would you like to do?
A demonstration of bash arrays.
#!/bin/bash
#
# A demonstration of bash arrays. See the secions titled "Arrays" and
# "Parameter Expansion" in the bash man page for details.
#
declare -A array;
array[a]="1";
array[b]="2";
array[c]="3";
array[d]="4";
for key in ${!array[@]}; do
value=${array[$key]}
echo "This is an array key/value pair: '$key' -> '$value'"
done
# vim: set ts=4 sw=0 et cc=80:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.