Looks like wrong quotes. To put a result of bash command to a variable:
doFilesExist=$(find . -maxdepth 1 -type f) or
doFilesExist=`find . -maxdepth 1 -type f` The part with if block should be also changed to [ -z "$doFilesExist" ]: "Inside a single-quoted string nothing(!!!!) is interpreted, except the single-quote that closes the quoting" source.