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