. Advertisement .
..3..
. Advertisement .
..4..
I encounter the error ”find: missing argument to `-exec”’ when I’m trying to run this command:
find a/folder b/folder -name *.c -o -name *.h -exec grep -I foobar '{}' +
I don’t know what’s wrong with this command. And I also tried:
find a/folder b/folder -name *.c -o -name *.h -exec grep -I foobar {} +
find a/folder b/folder -name *.c -o -name *.h -exec 'grep -I foobar' {} +
find a/folder b/folder -name *.c -o -name *.h -exec 'grep -I foobar' '{}' +
find a/folder b/folder -name "*.c" -o -name "*.h" -exec grep -I foobar '{}' +
find a/folder b/folder \( -name *.c -o -name *.h \) -exec grep -I foobar '{}' +
find a/folder b/folder -name *.c -o -name *.h -exec grep -I foobar '{}' \+
I am looking forward to gaining some knowledge from all experts. Thank you, guys!
The cause: Your attempts had a number of problems, including:
-o
clauses.find
used.Solution: The command can be simplified into the following:
If you’re using an outdated GNU find version, this should always work as well: