1 |
Author: zmedico |
2 |
Date: 2008-11-23 19:47:25 +0000 (Sun, 23 Nov 2008) |
3 |
New Revision: 12053 |
4 |
|
5 |
Modified: |
6 |
main/trunk/bin/etc-update |
7 |
Log: |
8 |
Bug #188780 - Make the read_int() function show a more human readable error |
9 |
message, instead of the 'value too great for base' message when the user |
10 |
enters an invalid value such as '1y'. |
11 |
|
12 |
|
13 |
Modified: main/trunk/bin/etc-update |
14 |
=================================================================== |
15 |
--- main/trunk/bin/etc-update 2008-11-23 07:47:43 UTC (rev 12052) |
16 |
+++ main/trunk/bin/etc-update 2008-11-23 19:47:25 UTC (rev 12053) |
17 |
@@ -223,7 +223,8 @@ |
18 |
read my_input |
19 |
# failed integer conversions will break a loop unless they're enclosed |
20 |
# in a subshell. |
21 |
- echo "${my_input}" | ( declare -i x; read x) && break |
22 |
+ echo "${my_input}" | ( declare -i x; read x) 2>/dev/null && break |
23 |
+ echo -n "Value '$my_input' is not valid. Please enter an integer value:" >&2 |
24 |
done |
25 |
echo ${my_input} |
26 |
} |