I want to use arrays in my sh script.
My target is to create an array with the values a b c
and print all values in the array.
I succeeded to print each array, but I failed to print all values in the array.
Following example:
Set each value in arr:
n=1
eval arr$n=a
n=2
eval arr$n=b
n=3
eval arr$n=c
Print each value from arr:
n=1
eval echo \$arr$n
a
n=2
eval echo \$arr$n
b
n=3
eval echo \$arr$n
c
Now I want to print all values in $arr
and instead of a b c
I get:
n="*"
eval echo \$arr$n
{*}*
The values should be a b c
.