From 29b44958186c4c761ada4db23caa1c3c4fa1f9bd Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 03 Aug 2017 13:11:44 -0400 Subject: try_rmdir(): Refactor Explicitly return either 0 or 1 and slightly improve logic readability. --- (limited to 'src') diff --git a/src/dir.sh b/src/dir.sh index 979ac53..6297c2c 100644 --- a/src/dir.sh +++ b/src/dir.sh @@ -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 } -- cgit v0.9.1