Previously wrote an article, with Shell timed purge expired files "Shell timed purge expired files", its practical is simple find command
After the colleague adopted, he debug the script, there are a few errors, I did the collation:
1.find:paths must precede expression:exec
The expression is incomplete, and an execute symbol "-" is added before exec.
2.find:missing argument to '-exec '
According to the hint, the wrong parameter-exec is actually a hint that you have an expression error.
The original statement is such a "Find/var/log/*.log-mtime +30-exec rm-f {}\;"
Workaround: Add a space in front of \ to pay special attention to
Solve the idea, first go to man find, just have find .-type f-exec file ' {} ';
This explanation is clear enough: Runs ' file ' on every file in or below the current directory. Notice that the braces is enclosed in a quote marks to protect them from interpretation as shell script punctuation. The semicolon is similarly protected by the use of a backslash, though single quotes could has been used in this case Also.
--not to be continued
Shell-find Error parsing