I am trying to concatenate strings using array variable but getting error.
declare -a arr
arr=(one two three)
var= "${arr[0]} ${arr[1]}"
echo $var
expected output
one two
(4 spaces between one and two)
I am getting following error:-
[wasadmin@gblabvl31 IBM]$ ./test.sh
./test.sh: line 10: one two: command not found
Does this mean we can't assign a variable with array element (used as a variable)? What is the other way to do this