When using the following command within a bash array, it loses the line separation of the array elements.
array=$(find "${PWD%/*}" -name '*.dmg')
If I redirect the path of the find command, without storing it in a variable, but storing it to a text file, it gives the desired result.
find "${PWD%/*}" -name '*.dmg' > Out.txt
But I would like to use the result as a variable in Bash and to loop through it.
In this case the find command should return an array with the path of all .dmg files in a directory. I want to loop through this array with the hdiutil
mount command in order to mount all the .dmg
files in the directory.