Do you want BuboFlash to help you learning these things? Or do you want to add or correct something? Click here to log in or create user.



Question

What does the code below give as output ?

$ declare -A my_array

$ my_array=([foo]=bar [baz]=foobar)

$ for key in "${!my_array[@]}"; do echo "$key"; done

Answer

baz

foo


Question

What does the code below give as output ?

$ declare -A my_array

$ my_array=([foo]=bar [baz]=foobar)

$ for key in "${!my_array[@]}"; do echo "$key"; done

Answer
?

Question

What does the code below give as output ?

$ declare -A my_array

$ my_array=([foo]=bar [baz]=foobar)

$ for key in "${!my_array[@]}"; do echo "$key"; done

Answer

baz

foo

If you want to change selection, open document below and click on "Move attachment"

How to use arrays in bash script - LinuxConfig.org
x is almost identical, but relies on the use of the ! operator: $ my_array=(foo bar baz) $ for index in "${!my_array[@]}"; do echo "$index"; done 0 1 2 The same is valid for associative arrays: <span>$ declare -A my_array $ my_array=([foo]=bar [baz]=foobar) $ for key in "${!my_array[@]}"; do echo "$key"; done baz foo As you can see, being the latter an associative array, we can't count on the fact that retrieved values are returned in the same order in which they were declared. Getting the size of a

Summary

statusnot learnedmeasured difficulty37% [default]last interval [days]               
repetition number in this series0memorised on               scheduled repetition               
scheduled repetition interval               last repetition or drill

Details

No repetitions


Discussion

Do you want to join discussion? Click here to log in or create user.