@Mat's solution is the cleanest, but in case you're interested in some bash-fu for fun, this also works based on the original find :
eval $(find . -maxdepth 1 -type f -exec echo . \'{}\'';' \;)
find used with -exec to create a search command for each file found, for example. . './foo'; . Pay attention to escaped single quotes to ensure that file names with special characters. handled properly.find will return a list of source search commands separated by a newline; using command substitution ( $() ) without the double quote, the shell discards these lines on a single line, using a space as a separator.- Finally,
eval executes a complete list of search commands in the context of the current shell (tested on OS X 10.8.1).
NOTE. One possible problem with this solution is that the command line can become large - perhaps too large - with many files and / or long file names.
mklement0
source share