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 ?

$ my_array=(foo bar baz)

$ echo "the array contains ${#my_array[@]} elements"

Answer
the array contains 3 elements

Question

What does the code below give as output ?

$ my_array=(foo bar baz)

$ echo "the array contains ${#my_array[@]} elements"

Answer
?

Question

What does the code below give as output ?

$ my_array=(foo bar baz)

$ echo "the array contains ${#my_array[@]} elements"

Answer
the array contains 3 elements
If you want to change selection, open document below and click on "Move attachment"

How to use arrays in bash script - LinuxConfig.org
d in the same order in which they were declared. Getting the size of an array We can retrieve the size of an array (the number of elements contained in it), by using a specific shell expansion: <span>$ my_array=(foo bar baz) $ echo "the array contains ${#my_array[@]} elements" the array contains 3 elements We have created an array which contains three elements, "foo", "bar" and "baz", then by using the syntax above, which differs from the one we saw before to retrieve the array values onl

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.