mirror of
https://github.com/jaygooby/ttfb.sh
synced 2025-12-10 07:57:21 +01: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:
8
ttfb
8
ttfb
@@ -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)
|
which -s $dependency || (echo "You need to have '$dependency' installed and in your \$PATH" >&2 && exit 1)
|
||||||
done
|
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
|
# Cribbed from https://stackoverflow.com/a/41762669/391826
|
||||||
median() {
|
median() {
|
||||||
arr=($(printf '%s\n' "${@}" | sort -n))
|
arr=($(printf '%s\n' "${@}" | sort -n))
|
||||||
|
|||||||
Reference in New Issue
Block a user