Commit 81753f59 authored by PENGUEN Julien's avatar PENGUEN Julien
Browse files

ajout function_check_number + tests pour les options qui doivent etre numeriques version macos

parent ee97d39f
......@@ -38,6 +38,19 @@ function_message()
echo ""
echo "------------------------------------"
elif [ "$type_message" == "TYPE_NOT_NUMBER" ]; then
echo ""
echo "------------------------------------"
echo ""
echo -e "\033[31m========================================================="
echo -e " ERROR with option '${option}' "
echo -e ""
echo -e "${message}"
echo -e "=========================================================\033[0m"
echo ""
echo "------------------------------------"
elif [ "$type_message" == "TYPE_HELP" ]; then
echo ""
......@@ -617,6 +630,24 @@ esac
}
function_check_number()
{
# function_check_number: return 'TRUE' if input arg is a
# number, if not "FALSE"
var=$1
if [[ $var = +([0-9]) ]] ; then
reponse="TRUE"
else
reponse="FALSE"
fi
echo "$reponse"
}
function_jar_updated_search()
{
# function_jar_updated_search: get the last jar version
......@@ -838,7 +869,6 @@ sort_arg_weight=( ${tab_sort_arg_weight// / } )
#check volume_mount input args
VOLUME_MOUNT=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--mount" $VOLUME_MOUNT`
echo "VOLUME_MOUNT=$VOLUME_MOUNT"
if [$VOLUME_MOUNT != "NONE" ];then
if [[ -d $VOLUME_MOUNT ]]; then
......@@ -882,26 +912,75 @@ fi
ANGULAR=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--angular" $ANGULAR`
ANGULAR_IS_NUMBER=`function_check_number "$ANGULAR"`
if [ $ANGULAR_IS_NUMBER != 'TRUE' ]; then
function_message "TYPE_NOT_NUMBER" "ANGULAR must be an integer" "--angular"
exit 0
fi
#-------------------------------------#
#check resolution line input args
RESOLUTION_BY_LINE=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--resolution_line" $RESOLUTION_BY_LINE`
RESOLUTION_BY_LINE_IS_NUMBER=`function_check_number "$RESOLUTION_BY_LINE"`
if [ $RESOLUTION_BY_LINE_IS_NUMBER != 'TRUE' ]; then
function_message "TYPE_NOT_NUMBER" "RESOLUTION_BY_LINE must be an integer" "--resolution_line"
exit 0
fi
#-------------------------------------#
#check resolution col input args
RESOLUTION_BY_COL=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--resolution_col" $RESOLUTION_BY_COL`
RESOLUTION_BY_COL_IS_NUMBER=`function_check_number "$RESOLUTION_BY_COL"`
if [ $RESOLUTION_BY_COL_IS_NUMBER != 'TRUE' ]; then
function_message "TYPE_NOT_NUMBER" "RESOLUTION_BY_COL must be an integer" "--resolution_col"
exit 0
fi
#-------------------------------------#
#check number of tile by line input args
NB_TILE_BY_LINE=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--nb_tile_line" $NB_TILE_BY_LINE`
NB_TILE_BY_LINE_IS_NUMBER=`function_check_number "$NB_TILE_BY_LINE"`
if [ $NB_TILE_BY_LINE_IS_NUMBER != 'TRUE' ]; then
function_message "TYPE_NOT_NUMBER" "NB_TILE_BY_LINE must be an integer" "--nb_tile_line"
exit 0
fi
#-------------------------------------#
#check number of tile by col input args
NB_TILE_BY_COL=`function_check_and_replace "${sort_arg_keys[*]}" "${sort_arg_values[*]}" "--nb_tile_col" $NB_TILE_BY_COL`
NB_TILE_BY_COL_IS_NUMBER=`function_check_number "$NB_TILE_BY_COL"`
if [ $NB_TILE_BY_COL_IS_NUMBER != 'TRUE' ]; then
function_message "TYPE_NOT_NUMBER" "NB_TILE_BY_COL must be an integer" "--nb_tile_col"
exit 0
fi
#---------------------#
# --no_select management
......@@ -1274,7 +1353,7 @@ case ${sort_arg_keys[0]} in
echo "VOLUME MOUNTED: NO VOLUME" >> ${infos_file[$k]}
fi
echo "" >> ${infos_file[$k]}
echo "Input surveys file: $INPUT_FILE_SURVEYS" >> ${infos_file[$k]}
echo "" >> ${infos_file[$k]}
echo "number of surveys: $nb_lines_survey" >> ${infos_file[$k]}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment