Question: I want to call use `find` on some filenames.

```
find $(do_something to find filenames) -print0 | xargs -r0 ls -ld

```

This breaks if `$(do_something to find filenames)` returns nothing: The find-command starts to do recursive search.

Is there a way to tell find to do nothing if it gets no explicit filename/dirname as argument?

Answer: 
With `zsh`, I'd do:

```
files=($(do_something to find filenames))
(($#files)) && find $files ...

```

With `tcsh`:

```
set files=(`do_something to find filenames`)
if ($#files) find $files:q ...

```

With `bash`, `mksh` or `ksh93`,

```
set -f; files=($(do_something to find filenames))
((${#files[@]})) && find "${files[@]}" ...

```

POSIXly:

```
set -f; set -- $(do_something to find filenames)
[ "$#" -gt 0 ] && find "$@" ...

```

(in bash and other POSIX shells, `$(...)` splits (on `$IFS`: space, tab and newline by default), but also performs globbing on the resulting words which I don't expect you'd want here hence the `set -f`. Other shells ((t)csh, zsh, fish, rc, es...) don't have that problem).
In `zsh` (and most non-Bourne derived shells), when a (or *all* depending on the shell) *glob* doesn't expand, the command is aborted.

`$(do_something to find filenames)` is not a glob, but you can make it become one by appending a glob qualifier in `zsh`:

```
 find $(do_something to find filenames)(#q) -print0...

```

Above, that `(#q)` (an empty glob qualifier, so does nothing otherwise) is appended to the last word resulting of the splitting of the output of `do_something to find filenames`, so the command will be aborted if that command produces no (or blank) output, but also if that last word (and that last word only) doesn't resolve to an existing path. You can make it apply to every word resulting of that splitting (so that the command be aborted if any of those words doesn't resolve to an existing file) with:

```
 find ${^$(do_something to find filenames)}(#q) -print0...

```