If I have a variable that has a value stored and I want to place that value into an array using the name of the variable, how would I do this?
e.g.:
variable="Hello there"
array[0]=$variable
does not make array[0] equal to "Hello there"
What am I doing wrong?
cmd ${array[0]}
orcmd ${array[@]}
. That should becmd "${array[0]}"
orcmd "${array[@]}"
, likeprintf '<%s>\n' "${array[@]}"
– Stéphane Chazelas Jan 16 at 17:12