diff options
-rw-r--r-- | bash.md | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -53,3 +53,27 @@ Don't interpolate variables: cat << 'EOF' > file bla bla EOF + +## Arrays + +Declaring indexed arrays: + + declare -a name + +Associative arrays: + + declare -A name + +Assignment: + + array=([bla]=foo [ble]=bar...) + +All values: + + ${array[*]} # one word, elements separated with first character of $IFS + ${array[@]} # separate words when double quoted + +All keys: + + ${!array[*]} + ${!array[@]} |