I'm trying to construct an array in bash of the filenames from my camera:
FILES=(2011-09-04 21.43.02.jpg
2011-09-05 10.23.14.jpg
2011-09-09 12.31.16.jpg
2011-09-11 08.43.12.jpg)
As you can see, there is a space in the middle of each filename.
I've tried wrapping each name in quotes, and escaping the space with a backslash, neither of which works.
When I try to access the array elements, it continues to treat the space as the elementdelimiter.
How can I properly capture the filenames with a space inside the name?
FILES[0] = ...
? (Edit: I just did; doesn't work. Interesting). – Dan Fego Jan 31 '12 at 17:43find . -maxdepth 1 -type f -iname \*.$1 -printf '%f\n'
); for element in ${array[@]}; do echo $element; done – Alex Hall May 1 '20 at 4:20