aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-09-01 22:59:08 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-09-01 22:59:08 +1200
commitcd63bce2f6f511078eb8fcf7a1c0e86eabb689d3 (patch)
treeb44887d54ec00d1f84716c390480fa7ebea33e0f /bin
parentMove HISTSIZE and MAILCHECK to shrc (diff)
downloaddotfiles-cd63bce2f6f511078eb8fcf7a1c0e86eabb689d3.tar.gz
dotfiles-cd63bce2f6f511078eb8fcf7a1c0e86eabb689d3.zip
Fix POSIX non-compliance in cfr(1)
Which slows it down a *lot*; add an issue.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/cfr6
1 files changed, 4 insertions, 2 deletions
diff --git a/bin/cfr b/bin/cfr
index 9bb0e3bb..36c5a7cf 100755
--- a/bin/cfr
+++ b/bin/cfr
@@ -1,4 +1,6 @@
#!/bin/sh
# Count files recursively with find(1); this includes the given directories
-# themselves and their subdirectories as entries
-find "${@:-"$PWD"}" -printf . | wc -c
+# themselves and their subdirectories as entries, and correctly handles files
+# with newlines in their names. It's also all POSIX ... but on big directories,
+# it's *slow*.
+find "${@:-.}" -exec printf %.sx {} \; | wc -c