Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
9
Task/Collections/UNIX-Shell/collections-1.sh
Normal file
9
Task/Collections/UNIX-Shell/collections-1.sh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
a_index=(one two three) # create an array with a few elements
|
||||
a_index+=(four five) # append some elements
|
||||
a_index[9]=ten # add a specific index
|
||||
for elem in "${a_index[@]}"; do # interate over the elements
|
||||
echo "$elem"
|
||||
done
|
||||
for idx in "${!a_index[@]}"; do # interate over the array indices
|
||||
printf "%d\t%s\n" $idx "${a_index[idx]}"
|
||||
done
|
||||
9
Task/Collections/UNIX-Shell/collections-2.sh
Normal file
9
Task/Collections/UNIX-Shell/collections-2.sh
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
declare -A a_assoc=([one]=1 [two]=2 [three]=3) # create an array with a few elements
|
||||
a_assoc+=([four]=4 [five]=5) # add some elements
|
||||
a_assoc[ten]=10
|
||||
for value in "${a_assoc[@]}"; do # interate over the values
|
||||
echo "$value"
|
||||
done
|
||||
for key in "${!a_assoc[@]}"; do # interate over the array indices
|
||||
printf "%s\t%s\n" "$key" "${a_assoc[$key]}"
|
||||
done
|
||||
1
Task/Collections/UNIX-Shell/collections-3.sh
Normal file
1
Task/Collections/UNIX-Shell/collections-3.sh
Normal file
|
|
@ -0,0 +1 @@
|
|||
declare -A
|
||||
1
Task/Collections/UNIX-Shell/collections-4.sh
Normal file
1
Task/Collections/UNIX-Shell/collections-4.sh
Normal file
|
|
@ -0,0 +1 @@
|
|||
typeset -A
|
||||
Loading…
Add table
Add a link
Reference in a new issue