From 85a9de0c3fcc2940422cc10c2fbc16694b2614a7 Mon Sep 17 00:00:00 2001 From: AuxXxilium Date: Fri, 16 Aug 2024 22:19:22 +0200 Subject: [PATCH] storagepanel: update (test) Signed-off-by: AuxXxilium --- storagepanel/all/usr/bin/storagepanel.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/storagepanel/all/usr/bin/storagepanel.sh b/storagepanel/all/usr/bin/storagepanel.sh index 3c293e1..89bba10 100755 --- a/storagepanel/all/usr/bin/storagepanel.sh +++ b/storagepanel/all/usr/bin/storagepanel.sh @@ -71,14 +71,13 @@ if [ "${1}" = "-r" ]; then exit fi -HDD_BAY="${1}" -if [ -n "${1}" ] && ! echo "${HDD_BAY_LIST[@]}" | grep -wq "${1}"; then - echo "storagepanel: parameter 1 error" - HDD_BAY="" +[ -n "${1}" ] && HDD_BAY="$(echo "${HDD_BAY_LIST[@]}" | grep -iwo "${1}")" || HDD_BAY="" +if [ -n "${1}" ] && [ -z "${HDD_BAY}" ]; then + echo "parameter 1 error" fi -SSD_BAY="${2}" -if [ -n "${2}" ] && [ -z "$(echo "${2}" | sed -n '/^[0-9]\{1,2\}X[0-9]\{1,2\}$/p')" ]; then +SSD_BAY="$(echo "${2^^}" | sed 's/*/X/')" +if [ -n "${SSD_BAY}" ] && [ -z "$(echo "${SSD_BAY}" | sed -n '/^[0-9]\{1,2\}X[0-9]\{1,2\}$/p')" ]; then echo "storagepanel: parameter 2 error" SSD_BAY="" fi