News for hackers. Stuff that matters.
Re:A common mistake involving wildcards and the find command... by dredmorbius on Friday December 10, 2021 @12:08PM (#29512321)
There are tools that use their own metacharacters (mmv(1) comes to mind).

The issue with find here is that globs act consistently, but the returned behaviour is dependent on when the evaluation is performed.

find(1) treats * just as the shell does, but only if the shell hasn't got to the * first. So to prevent the shell from pattern-matching any * characters, you've got to quote or escape them using single quotes (') or backstrokes (\).

Quoting to prevent interpretation of metacharacters is actually commonly encountered in computer contexts. I'm having to quote instances of * but not \ for example in this comment to HN as both have semantic meaning to the content parser. Note that the escape character '\' is only significant when used immediately preceding a *.

There are no comments on this comment yet.