Skip to content

Commit fd38c2e

Browse files
committed
fix: replace non-POSIX find depth flags
Signed-off-by: Lucas Larson <LucasLarson@riseup.net>
1 parent b910e97 commit fd38c2e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

CodeSnippets.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,10 @@ unset add >/dev/null 2>&1 || add=''
106106
command find -- \
107107
/System/Applications \
108108
/Applications \
109-
-maxdepth 3 \
110-
-name '*.app' 2>/dev/null |
109+
-path '/System/Applications/*/*/*' -prune -o \
110+
-path '/Applications/*/*/*' -prune -o \
111+
-name '*.app' \
112+
-print 2>/dev/null |
111113
command sed -e 's/.*\/\(.*\)\.app/\1/' |
112114
LC_ALL='C' command sort -d -f
113115
```
@@ -210,7 +212,7 @@ command printf -- '%s\n' "${PATH-}" |
210212
### executables
211213

212214
```shell
213-
command printf -- '%s\n' "${PATH-}" | command sed -e 's/:/\n/g' | while IFS='' read -r -- directory; do command find -- "${directory-}" -mindepth 1 -maxdepth 1 ! -type d -exec test -x {} ';' -print 2>/dev/null; done
215+
command printf -- '%s\n' "${PATH-}" | command sed -e 's/:/\n/g' | while IFS='' read -r -- directory; do command find -- "${directory-}" -path "${directory-}"'/*/*' -prune -o -path "${directory-}"'/*' ! -type d -exec test -x {} ';' -print 2>/dev/null; done
214216
```
215217

216218
## text editing
@@ -336,19 +338,19 @@ cppcheck --force -I "${CPATH-}" .
336338
[via](https://stackoverflow.com/q/32029445), [via](https://stackoverflow.com/q/33662375)
337339

338340
```shell
339-
command find -- . -maxdepth 1 -name '*.c' -type f -exec gcc -std=c89 --verbose -save-temps -v -Wall -Wextra -pedantic -- {} +
341+
command find -- . -path './*/*' -prune -o -name '*.c' -type f -exec gcc -std=c89 --verbose -save-temps -v -Wall -Wextra -pedantic -- {} +
340342
```
341343

342344
#### C++
343345

344346
```shell
345-
command find -- . -maxdepth 1 -name '*.cpp' -type f -exec g++ -std=c++2a --verbose -Wall -Wextra -pedantic -save-temps -v -pthread -fgnu-tm -lm -latomic -lstdc++ -- {} +
347+
command find -- . -path './*/*' -prune -o -name '*.cpp' -type f -exec g++ -std=c++2a --verbose -Wall -Wextra -pedantic -save-temps -v -pthread -fgnu-tm -lm -latomic -lstdc++ -- {} +
346348
```
347349

348350
#### Clang
349351

350352
```shell
351-
command find -- . -maxdepth 1 -name '*.cpp' -type f -exec clang++ -std=c++2a --verbose -Wall -Wextra -pedantic -v -lm -lstdc++ -pthread -save-temps -- {} +
353+
command find -- . -path './*/*' -prune -o -name '*.cpp' -type f -exec clang++ -std=c++2a --verbose -Wall -Wextra -pedantic -v -lm -lstdc++ -pthread -save-temps -- {} +
352354
```
353355

354356
## Gatekeeper

0 commit comments

Comments
 (0)