I am trying to do something like below:
for a in apple orange grape; do ${!a}="blah" done echo $apple blah
Possible?
Use declare.
declare
for a in apple orange grape; do declare "$a=blah" done
I wonder if you can associative arrays instead :
declare -A myarray for a in apple orange grape; do myarray[$a]="blah" done echo ${myarray[apple]}
Note that associative arrays require bash version 4.0 or higher.
Source: https://habr.com/ru/post/1537776/More articles:How do C ++ threads work? - c ++https://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1537772/files-from-yeoman-web-app-that-needs-to-be-committed-in-scmgit&usg=ALkJrhgkArbS_a1cuFszsYQDQWdrmN6uAAMemory leak using Curl and OpenSSL - cBibTeX parsing library - javascriptHow can I change the opacity of an image without changing the contents of the div? - csssometimes javascript works perfect, and sometimes not in ruby ββon rails 4 - javascriptHow to call Java static method without arguments in Clojure? - javaInvoking additional actions before the MST timeout expires process threads - c #Transferring data with a few actions - androidvb.net, javascript issue including strict mode - javascriptAll Articles