Skip to content

Instantly share code, notes, and snippets.

@linhxhust
Created May 9, 2017 00:54
Show Gist options
  • Save linhxhust/67c329ddec924b42bfbdf0aed8f6e024 to your computer and use it in GitHub Desktop.
Save linhxhust/67c329ddec924b42bfbdf0aed8f6e024 to your computer and use it in GitHub Desktop.
#!/bin/bash
SAMPLE_ARR=("one" "two" "three" "four")
printf ${SAMPLE_ARR[*]} # one two three four
printf ${SAMPLE_ARR[@]} # one two three four
printf ${SAMPLE_ARR[1]} # two
SAMPLE_ARR[4]="five"
printf ${SAMPLE_ARR[*]} # one two three four five
unset SAMPLE_ARR[2]
printf ${SAMPLE_ARR[*]} # one two four five
unset SAMPLE_ARR
printf ${SAMPLE_ARR[*]} # nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment