Created SC2185 (markdown)

koalaman
2016-09-25 12:31:58 -07:00
parent 25b1332d57
commit a1a83b2482

24
SC2185.md Normal file

@@ -0,0 +1,24 @@
## Some finds don't have a default path. Specify '.' explicitly.
### Problematic code:
```sh
find -type f
```
### Correct code:
```sh
find . -type f
```
### Rationale:
When not provided a search path, GNU and Busybox `find` will use a default path of `.`, the current directory.
On POSIX, macOS/OSX, FreeBSD, OpenBSD and NetBSD, it will instead result in an error.
Explicitly specifying a path works across all implementations, and is therefore preferred.
### Exceptions:
None.