aboutsummaryrefslogtreecommitdiff
path: root/bin/cfr
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-09-03 13:47:32 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-09-03 13:47:32 +1200
commita5e6ef729682573cc4a0452d714209cb8d6d9d5c (patch)
tree9c35a52694521fb84f9f01d4a2b04ac50c5c8876 /bin/cfr
parentTidy/correct tl(1) option parsing (diff)
downloaddotfiles-a5e6ef729682573cc4a0452d714209cb8d6d9d5c.tar.gz
dotfiles-a5e6ef729682573cc4a0452d714209cb8d6d9d5c.zip
Correction and error catching for cfr(1df)
Diffstat (limited to 'bin/cfr')
-rwxr-xr-xbin/cfr6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/cfr b/bin/cfr
index 33075dc5..52a9bb2b 100755
--- a/bin/cfr
+++ b/bin/cfr
@@ -1,7 +1,11 @@
#!/bin/sh
# Count all descendants of given directories; don't follow symlinks
for dir in "${@:-.}" ; do
+ if ! [ -d "$dir" ] ; then
+ printf >&2 'cfr: %s: Not a directory\n' "$dir"
+ continue
+ fi
printf '%u\t%s\n' \
- "$(find "$dir" -type d -exec cf -o -- {} \; | tot)"
+ "$(find "$dir" -type d -exec cf -o -- {} \; | tot)" \
"$dir"
done