Skip to content

Instantly share code, notes, and snippets.

@bench
Last active February 7, 2018 20:43
Show Gist options
  • Save bench/c37a1a1ec9aaa779933184162b585edc to your computer and use it in GitHub Desktop.
Save bench/c37a1a1ec9aaa779933184162b585edc to your computer and use it in GitHub Desktop.
declare and use an array bash
declare -a MYARRAY
# Static index
MYARRAY[0]="first value"
# Dynamic index
MYARRAY[${i}]="another value"
# Access an element of an array
echo "Hello my value is ${MYARRAY[$i]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment