From 1aa5943e67d8237344538074990556d5a3522319 Mon Sep 17 00:00:00 2001 From: Jacob Salmela Date: Mon, 22 May 2017 01:06:15 -0500 Subject: [PATCH] add if directory exists function --- advanced/Scripts/piholeDebug.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/advanced/Scripts/piholeDebug.sh b/advanced/Scripts/piholeDebug.sh index faf68fb9..9da749e7 100755 --- a/advanced/Scripts/piholeDebug.sh +++ b/advanced/Scripts/piholeDebug.sh @@ -88,6 +88,19 @@ if_file_exists() { fi } +if_directory_exists() { + # Set the first argument passed to tihs function as a named variable for better readability + local directory_to_test="${1}" + # If the file is readable + if [[ -d "${directory_to_test}" ]]; then + # Return success + return 0 + else + # Otherwise, return a failure + return 1 + fi +} + get_distro_attributes() { # Put the current Internal Field Separator into another variable so it can be restored later OLD_IFS="$IFS"