I have a script (in Node.js) named script.js which outputs the following string:
(1, 2, 3)
I want to read it in a loop in the following way:
INDICES=$(node script.js)
for i in "{INDICES[@]}"
do
echo $i
done
Instead of printing
1
2
3
I get
(1, 2, 3)
Since the script output is read as string.
How do I make it an array?
Best Answer
which give this output