diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-11-25 20:21:35 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-11-25 20:21:35 +1300 |
commit | b6df9ed3c173f47271f447b1d0b79ae7f90683af (patch) | |
tree | cb87f300a9d097b7a4f668c5eb99b7e4d7ec28e4 /bin | |
parent | Add finc(1df) (diff) | |
download | dotfiles-b6df9ed3c173f47271f447b1d0b79ae7f90683af.tar.gz dotfiles-b6df9ed3c173f47271f447b1d0b79ae7f90683af.zip |
Handle find(1) path metachars
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cf | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 ) |