diff --git a/initrd/bin/change-time b/initrd/bin/change-time index 1a130e7f..890b3c5d 100755 --- a/initrd/bin/change-time +++ b/initrd/bin/change-time @@ -13,23 +13,16 @@ get_date () { min="$2" max="$3" digits="$4" - echo -e -n "Please insert $field_name (between $min-$max) (Enter key to accept $min)\n" + echo "Please insert $field_name (between $min-$max)" read -r value - echo -e "\n" - #if enter - if [[ $value = "" ]]; then - value=$min - fi + echo #must be a number between $2 and $3 - while [[ ! $value =~ ^[0-9]*$ ]] || [[ ${value#0} -lt $min ]] || [[ ${value#0} -gt $max ]]; + while [[ ! $value =~ ^[0-9]+$ ]] || [[ ${value#0} -lt $min ]] || [[ ${value#0} -gt $max ]]; do - echo -e -n "$field_name is wrong: you entered \"$value\". Please try again, it must be a number between $min and $max (press Enter to accept $min) \n" + echo "$field_name is wrong: you entered \"$value\". Please try again, it must be a number between $min and $max" read -r value - echo -e "\n" - if [[ $value = "" ]]; then - value=$min - fi + echo done # Pad with zeroes to digits