In python, I can do this in one line:
>>> for key, value in dict(j=1, k=2).items():
... print(key, value)
...
j 1
k 2
>>>
In bash, I can do this:
$ map=([j]=1 [k]=2); for key in ${!map[@]}; do value=${map[$key]}; echo $key $value; done
j 1
k 2
$
Is there a way in bash to “inline” map
declaration into for
– similarly how it’s possible in the python example – instead of declaring it beforehand?