find: missing argument to `-exec'

Today cleanup write a script, use the find command.

It could have been so written:

find . -type f -mtime +7 -name "*.log" -exec rm -rf {} \

The results error, the Find: Missing argument to `-exec '

Later, an investigation found that two can cause this problem.

1. "{}" and "\" include a space between
 
2. This statement requires a semicolon at the end of

Obviously, I did not add a semicolon.
 
So add a semicolon at the end of this sentence to run normal shell.

find . -type f -mtime +7 -name "*.log" -exec rm -rf {} \;

Guess you like

Origin www.cnblogs.com/young233/p/11986633.html