Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • Have you tried adding the files the old-fashioned way? Like FILES[0] = ...? (Edit: I just did; doesn't work. Interesting).
    – Dan Fego
    Commented Jan 31, 2012 at 17:43
  • POSIX: stackoverflow.com/questions/2936922/… Commented Apr 21, 2018 at 8:28
  • All of the answers here break down for me using Cygwin. It does weird things if there are spaces in file names, period. I work around it by creating an "array" in a text file listing of all elements I want to work with, and iterating over lines in the file: Formatting is mucking with intended backticks here surrounding the command in parenthesis: IFS=""; array=(find . -maxdepth 1 -type f -iname \*.$1 -printf '%f\n'); for element in ${array[@]}; do echo $element; done
    – Alex Hall
    Commented May 1, 2020 at 4:20