I’m currently pawing through a Unix tutorial and I’ve been met with this:
find ~ -name test3* -ok rm {}\;
I’m curious as to what the {}\; does.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
{}\;string tells find(1) that (a) the file name is to be substituted in place of the{}, and (b) that the commands ends at the “;”. The “;” has to be escaped (hence the backslash) because it has special meaning to the shell. For that same reason, you really ought to quote the ‘test3*’ string. You want find to expand that, not the shell. If there happen to be matching files in the directory where you run find, you’re not going to get the results you expect.Thus, you’re telling find(1) to run “rm” on every file it finds.
There’s a more efficient solution to that particular problem, though: