From fafd2cfc20d2c11965e7be1fdadbd9471a95e0c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 27 Feb 2020 15:58:06 +0100 Subject: [PATCH] Get the test to run --- smart.run.test.sh | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/smart.run.test.sh b/smart.run.test.sh index 990928b..dbddc87 100755 --- a/smart.run.test.sh +++ b/smart.run.test.sh @@ -40,12 +40,12 @@ EXAMPLE : HELP } ## ]]] -## Check the arguments [[[ -check_arguments() { +## Manage the arguments [[[ +manage_arguments() { _nb_arg="${#}" _all_args="${*}" - [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : check_arguments func − ${_nb_arg} argument(s) to manage. List:\n ${_all_args}" + [ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG : manage_arguments func − ${_nb_arg} argument(s) to manage. List:\n ${_all_args}" ## If help is needed [[[ if printf -- '%s' "${_all_args}" | grep -q -E -- "-h|--help|help"; then @@ -55,6 +55,23 @@ check_arguments() { exit 0 fi ## ]]] +# Manage arguments [[[ +case "${_nb_arg}" in + 0 ) + ## Set test to run to default (short) + test_to_run="short" + ;; + 1 ) + test_to_run="${1}" + ;; + * ) + ## More than managed number of arguments + print_help_message + exit 2 + ;; +esac +# ]]] + } ## ]]] ## Test if a disk really support SMART [[[ @@ -119,7 +136,7 @@ choose_correct_type() { } ## ]]] -check_arguments "${@}" +manage_arguments "${@}" # Create files true > "${smart_device_list}"