aboutsummaryrefslogtreecommitdiff
path: root/bin/cf
diff options
context:
space:
mode:
Diffstat (limited to 'bin/cf')
-rwxr-xr-xbin/cf6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/cf b/bin/cf
index 362e4eba..5e2f42b9 100755
--- a/bin/cf
+++ b/bin/cf
@@ -14,9 +14,13 @@ for dir in "${@:-.}" ; do
continue
fi
+ # Make an escaped form of the directory to handle cases where the directory
+ # name actually has find(1) pattern metacharacters in it
+ dirx=$(printf %s "$dir" | sed 's/\([*?\[\]]\)/\\\1/g')
+
# Count the files
count=$(
- find "$dir" ! -path "$dir" -prune -exec printf %.sx {} + |
+ find "$dir" ! -path "$dirx" -prune -exec printf %.sx {} + |
wc -c
)