diff options
author | P. J. McDermott <pj@pehjota.net> | 2017-08-03 13:11:44 (EDT) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2017-08-03 13:11:44 (EDT) |
commit | 29b44958186c4c761ada4db23caa1c3c4fa1f9bd (patch) | |
tree | 4cc4a7a212541bbe76566ca7b350c81c78b95343 /src | |
parent | c0bd6406879ce9c2f7c6fd2693edffcf2a64d492 (diff) |
try_rmdir(): Refactor
Explicitly return either 0 or 1 and slightly improve logic readability.
Diffstat (limited to 'src')
-rw-r--r-- | src/dir.sh | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -65,10 +65,12 @@ try_rmdir() { local dir="${1}" - if dir_is_empty "${dir}"; then - rmdir "${dir}" - return ${?} - else + if ! dir_is_empty "${dir}"; then + return 1 + fi + if ! rmdir "${dir}"; then return 1 fi + + return 0 } |