the “array” variable is not well initialized. To capture the output of the commands you are executing, they should be sourrounded by $()
With this change, the script works for me:
array=$(grep "\bd=" $file | sed -r "s/(-)?[0-9]+(\.)?(-)?([0-9]*)?,(-)?[0-9]+(\.)?(-)?([0-9]*)?/{ & },\n/g" | grep -o "{.*},")
0
solved Exporting SVG image to points using bash