Extract subset of key-value pairs from dictionary?
I have a big dictionary object that has several key value pairs (about 16), but I am only interested in 3 of them. What is the best way (shortest/efficient/most elegant) to achieve that?
I have a big dictionary object that has several key value pairs (about 16), but I am only interested in 3 of them. What is the best way (shortest/efficient/most elegant) to achieve that?
A few Bourne-like shells support associative arrays: ksh93 (since 1993), zsh (since 1998), bash (since 2009), though with some differences in behaviour between the 3.
I saw a trick for implementing associative arrays in a shell script. For example print array["apples"] could be scripted as echo $array$key where key=apples.
Is there a way to print an entire array ([key]=value) without looping over all elements?