From 4f51ee84460961bdf430253a5cccddcb2a5c8db1 Mon Sep 17 00:00:00 2001 From: Marcus Whybrow Date: Tue, 12 Jun 2012 03:16:41 +0100 Subject: [PATCH] Prevented errors when listing no jar groups. --- init/msm | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/init/msm b/init/msm index 77a46a7..90079a2 100755 --- a/init/msm +++ b/init/msm @@ -520,19 +520,21 @@ server_set_active() { # Lists the jar files grouped by jar groups. jargroup_list() { - local jargroup_name - local jar_name + if [[ -d "${JAR_STORAGE_PATH}" ]]; then + local jargroup_name + local jar_name - while IFS= read -r -d $'\0' jargroup_path; do - jargroup_name="$(basename "${jargroup_path}")" - echo "$jargroup_name" - while IFS= read -r -d $'\0' jar_path; do - jar_name="$(basename "${jar_path}")" - if [[ "$jar_name" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}- ]]; then - echo " $jar_name" - fi - done < <(find "${JAR_STORAGE_PATH}/${jargroup_name}" -mindepth 1 -maxdepth 1 -type f -print0) - done < <(find "${JAR_STORAGE_PATH}" -mindepth 1 -maxdepth 1 -type d -print0) + while IFS= read -r -d $'\0' jargroup_path; do + jargroup_name="$(basename "${jargroup_path}")" + echo "$jargroup_name" + while IFS= read -r -d $'\0' jar_path; do + jar_name="$(basename "${jar_path}")" + if [[ "$jar_name" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}- ]]; then + echo " $jar_name" + fi + done < <(find "${JAR_STORAGE_PATH}/${jargroup_name}" -mindepth 1 -maxdepth 1 -type f -print0) + done < <(find "${JAR_STORAGE_PATH}" -mindepth 1 -maxdepth 1 -type d -print0) + fi } # Creates a new jargroup