Pascal Polleunus
Pascal Polleunus

Reputation: 2521

find . -exec echo {} \; = missing argument to `-exec'

Why doesn't this work? (echo is not the real command)

$ find . -type d -exec echo {} \;
find: missing argument to `-exec'

I managed to do that anyway like this:

$ for f in `find . -type d`; do echo $f; done

Upvotes: 9

Views: 15927

Answers (2)

bakalov
bakalov

Reputation: 321

This work for me.

find . -type f -exec file '{}' \;

Braces are enclosed in single quote marks to protect them from interpretation as shell script punctuation.

Upvotes: 7

djhaskin987
djhaskin987

Reputation: 10057

The following line is from the EXAMPLES section of man find:

find . -type f -exec file '{}' \;

It looks to me like the {} part needs to be in single quotes.

Upvotes: 0

Related Questions