blob: 63750a37a808689fa6cf1def6a3947242ded614a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/bin/sh
# quoteconvert2.sh --- test locale dependent output of numbers
# Michal Jaegermann, michal@harddata.com, 2014/Mar/1
#AWK="../gawk"
SCRIPT=`basename $0`
if [ "$AWK" = "" ]
then
echo $0: You must set AWK >&2
exit 1
fi
# The last entry on this list represents "a locale with a typo".
llist="
C
en_US
en_US.UTF-8
de_DE
de_DE.UTF-8
fr_FR
fr_FR.UTF-8
pt_PT
pt_PT.UTF-8
pt_BR
pt_BR.UTF-8
ru_RU
ru_RU.UTF-8
pl_PX
"
error=0
for lc in $llist ; do
wanted=`LC_ALL=$lc locale -c LC_NUMERIC 2>/dev/null | \
$AWK 'NR == 2 { decimal_point = $0 }
NR == 3 { thousands_sep = $0 }
END { printf("123%s456%s789%s15\n",
thousands_sep, thousands_sep, decimal_point)}'`
got=`LC_ALL=$lc $AWK "BEGIN {printf(\"%'.2f\n\",123456789.15)}"`
if [ "$wanted" != "$got" ] ; then
echo "$lc - unexpected output $got instead of $wanted"
error=1
fi
done
[ "$error" = 0 ] && echo ok || echo bummer
exit $error
|