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) $ for index in "${!my_array[@]}"; do echo "$index"; done

Answer

0

1

2


Question

What does the code below give as output ?

$ my_array=(foo bar baz) $ for index in "${!my_array[@]}"; do echo "$index"; done

Answer
?

Question

What does the code below give as output ?

$ my_array=(foo bar baz) $ for index in "${!my_array[@]}"; do echo "$index"; done

Answer

0

1

2

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

How to use arrays in bash script - LinuxConfig.org
ven possible to retrieve and print the keys used in an indexed or associative array, instead of their respective values. The syntax is almost identical, but relies on the use of the ! operator: <span>$ my_array=(foo bar baz) $ for index in "${!my_array[@]}"; do echo "$index"; done 0 1 2 The same is valid for associative arrays: $ 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 th

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.