mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-10-03 19:29:44 +08:00
Created SC2185 (markdown)
24
SC2185.md
Normal file
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.
|
Reference in New Issue
Block a user