On 05/18/2015 11:36 AM, Ted Byers wrote:
Alas, there seems to be a typo, or something. The following is what I got in the session in which I tried:
ted@gremlin:~> find /var/log/ -type f -mtime +30 -exec rm -rf {}; find: missing argument to `-exec' ted@gremlin:~>
Why would it not see 'rm -rf {}; as the argument for '-exec'?
Cracked record time comes round once again. RTFM $ man 1 find <quote> -exec command ; ... The string `{}' is replaced ..... Both of these constructions might need to be escaped (with a `\') or quoted to protect them from expansion by the shell. See the EXAMPLES section for examples of the use of the -exec option. </quote> The EXAMPLES section <quote emphasis added> find . -type f -exec file '{}' \; Runs `file' on every file in or below the current directory. *Notice that the braces are enclosed in single 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 have been used in that case also.* </quote> The use of single quotes or backslash to prevent (possibly premature) shell interpretation is a common and well documented feature of Linux and all other UNIX derivatives. It is a fundamental pattern that should be in the cognitive DNA of all command line users. http://www.quickmeme.com/img/40/4005465b41f4f1deb452e0762514c63755379730b540... -- A: Yes. > Q: Are you sure? >> A: Because it reverses the logical flow of conversation. >>> Q: Why is top posting frowned upon? -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org