Ensure arguments have expected values
This commit is contained in:
parent
fafd2cfc20
commit
cf12d2bcd9
|
@ -40,6 +40,18 @@ EXAMPLE :
|
|||
HELP
|
||||
}
|
||||
## ]]]
|
||||
## Check arguments [[[
|
||||
## Ensure arguments have the expected value
|
||||
check_arguments() {
|
||||
if ! printf -- '%s' "${test_to_run}" | grep -q -E -- "(short|long)"; then
|
||||
printf "${c_redb}%-6b${c_reset}\n" "ERROR : Can't manage '${test_to_run}' test type."
|
||||
|
||||
print_help_message
|
||||
|
||||
exit 3
|
||||
fi
|
||||
}
|
||||
## ]]]
|
||||
## Manage the arguments [[[
|
||||
manage_arguments() {
|
||||
_nb_arg="${#}"
|
||||
|
@ -55,7 +67,7 @@ manage_arguments() {
|
|||
exit 0
|
||||
fi
|
||||
## ]]]
|
||||
# Manage arguments [[[
|
||||
## Manage arguments [[[
|
||||
case "${_nb_arg}" in
|
||||
0 )
|
||||
## Set test to run to default (short)
|
||||
|
@ -70,8 +82,9 @@ case "${_nb_arg}" in
|
|||
exit 2
|
||||
;;
|
||||
esac
|
||||
# ]]]
|
||||
|
||||
## ]]]
|
||||
## Verify the content of arguments
|
||||
check_arguments
|
||||
}
|
||||
## ]]]
|
||||
## Test if a disk really support SMART [[[
|
||||
|
|
Loading…
Reference in New Issue