I wrote this code to make an Array containing my images:
listOfImages=(`find . -iname "*.png" 2>/dev/null`)
But the path could have spaces in it so I have to enclose every element in double quotes:
listOfImages=(`find . -iname "*.png" 2>/dev/null | sed -E -e 's/(.*)/"\1"/'`)
Normally when we print an Array's elements, it should not print the double quotes, example:
x=("a" "b")
for i in ${x[@]}
do
echo "$i"
done
And it prints:
a
b
But on my images Array, it prints with the double quotes which causes problems on the following codes on my script.
Demonstration:
for i in ${listOfImages[@]}
do
echo $i
done
And it prints:
"blocks/glass.png"
"blocks/glass_black.png"