Latest Blog Post

BASH find not finding all files

A painful discovery in the sense of time... the missing quotes on the following code was causing unexpected behavior when I was trying to locate files in BASH using find. When I did not have the double quotes around the -name option values, they were not functioning as wildcards as I'd expected.

This did not work:

files=$(find "," -name *.psp.md -or -name *.psp.txt -or -name *.psp.sh)

This did work:

files=$(find "." -name "*.psp.md" -or -name "*.psp.txt" -or -name "*.psp.sh") 

Portfolio

Valid XHTML 1.0 Transitional