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).
You can give `find` an extra, non-existant directory to start from:

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

```

To make this tidy, drop `find`'s error output:

```
find " " $(do_something to find filenames) -print0 2>/dev/null | xargs -r0 ls -ld

```

(but then you won't notice if another error occurs...).

When `do_something to find filenames` outputs filenames, `find` will complain about `" "` but will still process the rest of the command line. When no filenames are output, `find` will again complain about `" "` but won't add its default `.`.