Skip to content

Instantly share code, notes, and snippets.

@sullust
Created August 29, 2012 17:03
Show Gist options
  • Save sullust/3515669 to your computer and use it in GitHub Desktop.
Save sullust/3515669 to your computer and use it in GitHub Desktop.
area[11]=23
area[13]=37
area[51]=UFOs
# Array members need not be consecutive or contiguous.
# Some members of the array can be left uninitialized.
# Gaps in the array are okay.
# In fact, arrays with sparse data ("sparse arrays")
#+ are useful in spreadsheet-processing software.
echo -n "area[11] = "
echo ${area[11]} # {curly brackets} needed.
echo -n "area[13] = "
echo ${area[13]}
echo "Contents of area[51] are ${area[51]}."
# Contents of uninitialized array variable print blank (null variable).
echo -n "area[43] = "
echo ${area[43]}
echo "(area[43] unassigned)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment