mirror of
https://github.com/jaygooby/ttfb.sh.git
synced 2026-10-24 14:01:15 +02:00
Ensure curl uses period separators for floating point values
`bc` requires these to do calculations; it can't use locale separators like `,` https://en.wikipedia.org/wiki/Decimal_separator#Countries_using_decimal_comma
This commit is contained in:
1 parent
c8088c7f63
commit
7243614da2
1 file changed
+8
@@ -65,6 +65,14 @@ for dependency in curl bc column; do
|
||||
which -s $dependency || (echo "You need to have '$dependency' installed and in your \$PATH" >&2 && exit 1)
|
||||
done
|
||||
|
||||
# Ensure curl uses period separators for floating point values, which
|
||||
# bc requires to do calculations (i.e. it can't use locale separators like ,)
|
||||
if (locale -a | egrep ^C.UTF-8$); then
|
||||
export LC_ALL=C.UTF-8
|
||||
else
|
||||
export LC_ALL=C
|
||||
fi
|
||||
|
||||
# Cribbed from https://stackoverflow.com/a/41762669/391826
|
||||
median() {
|
||||
arr=($(printf '%s\n' "${@}" | sort -n))
|
||||
|
||||
Reference in new issue
Block a user