From 7da4415b8e481455c9718560712eeb17a02a26a8 Mon Sep 17 00:00:00 2001 From: UltimateByte Date: Tue, 15 Mar 2016 11:13:25 +0100 Subject: [PATCH] Rework while --- lgsm/functions/check_permissions.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/lgsm/functions/check_permissions.sh b/lgsm/functions/check_permissions.sh index 8828a15d7..51072f43d 100644 --- a/lgsm/functions/check_permissions.sh +++ b/lgsm/functions/check_permissions.sh @@ -22,13 +22,19 @@ fi fn_check_permissions(){ if [ -n "${functionsdir}" ]; then - find "${functionsdir}" -name "*.sh" | while read -r filename; do perm="$(stat -c %a "${filename}")"; shortperm="${perm:0:1}"; + while read -r filename + do + perm="$(stat -c %a "${filename}")" + shortperm="${perm:0:1}" if [ "${shortperm}" != "7" ]; then - fn_print_warn_nl "Warning, permission issues found in ${functionsdir}" - echo " * Easy fix : chmod -R 755 ${functionsdir}" - echo " * To enable monitor run ./${selfname} start" + permissionfailure="1" fi - done + done <<< "$(find "${functionsdir}" -name "*.sh")" + + if [ "${permissionfailure}" == "1" ]; then + fn_print_warn_nl "Warning, permission issues found in ${functionsdir}" + echo " * Easy fix : chmod -R 755 ${functionsdir}" + fi fi }