mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-24 07:06:42 +00:00
change-time: Improve prompt wording
Adjust prompt wording when entering fields. Technically the desired value isn't always between min/max, because min and max are also acceptable :) No need to repeat an incorrect value, it is right there on the screen and it dilutes the important point describing what value is needed. Signed-off-by: Jonathon Hall <jonathon.hall@puri.sm>
This commit is contained in:
parent
355b7bc302
commit
653542870d
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
clear
|
clear
|
||||||
|
|
||||||
echo -e -n "Please enter the date and time you wish to set\n"
|
echo -e -n "Please enter the current date and time in UTC\n"
|
||||||
echo -e -n "You need to set the time according to the UTC/GMT timezone please check https://time.is/UTC\n\n"
|
echo -e -n "To find the current date and time in UTC, please check https://time.is/UTC\n\n"
|
||||||
|
|
||||||
|
|
||||||
get_date () {
|
get_date () {
|
||||||
@ -12,14 +12,15 @@ get_date () {
|
|||||||
field_name="$1"
|
field_name="$1"
|
||||||
min="$2"
|
min="$2"
|
||||||
max="$3"
|
max="$3"
|
||||||
echo "Please insert $field_name (between $min-$max)"
|
echo -n "Enter the current $field_name [$min-$max]: "
|
||||||
read -r value
|
read -r value
|
||||||
echo
|
echo
|
||||||
|
|
||||||
#must be a number between $2 and $3
|
#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
|
do
|
||||||
echo "$field_name is wrong: you entered \"$value\". Please try again, it must be a number between $min and $max"
|
echo "Please try again, it must be a number from $min to $max."
|
||||||
|
echo -n "Enter the current $field_name [$min-$max]: "
|
||||||
read -r value
|
read -r value
|
||||||
echo
|
echo
|
||||||
done
|
done
|
||||||
|
Loading…
Reference in New Issue
Block a user