You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$> echo ${my_array}
one
$> echo ${my_array[0]}
one
$> echo ${my_array[1]}
two
$> my_array[4]=five
dumping values
$> echo ${my_array[@]}
one two three five
dumping indices
$> echo ${!my_array[@]}
0 1 2 4
counting elements
$> echo ${#my_array[@]}
4
stringify array (return as one element)
$> echo ${my_array[*]}
one two three four
iterating on an array using index
$> for index in ${!my_array[@]}; do echo "Element N°${index} => ${my_array[$index]}"; done
Element N°0 => one
Element N°1 => two
Element N°2 => three
Element N°4 => five
iterating on an array extracting values
$> for element in ${my_array[@]}; do echo "Found element ${element}"; done
Found element one
Found element two
Found element three
Found element five