Skip to content

Latest commit

 

History

History
27 lines (16 loc) · 759 Bytes

SC2061.md

File metadata and controls

27 lines (16 loc) · 759 Bytes

Pattern: Unquoted option for find

Issue: -

Description

Several find options take patterns to match against, including -ilname, -iname, -ipath, -iregex, -iwholename, -lname, -name, -path, -regex and -wholename.

These compete with the shell's pattern expansion, and must therefore be quoted so that they are passed literally to find.

The example command may end up executing as find . -name README.txt after the shell has replaced the *.txt with a matching file README.txt from the current directory.

Example of incorrect code:

find . -name *.txt

Example of correct code:

find . -name '*.txt'

Further Reading