diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-03 13:47:32 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-03 13:47:32 +1200 |
commit | a5e6ef729682573cc4a0452d714209cb8d6d9d5c (patch) | |
tree | 9c35a52694521fb84f9f01d4a2b04ac50c5c8876 /bin | |
parent | Tidy/correct tl(1) option parsing (diff) | |
download | dotfiles-a5e6ef729682573cc4a0452d714209cb8d6d9d5c.tar.gz dotfiles-a5e6ef729682573cc4a0452d714209cb8d6d9d5c.zip |
Correction and error catching for cfr(1df)
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/cfr | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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 |