Skip to content

Commit 48df1b8

Browse files
committed
Fix locale
Fixed `math__calc` giving wrong output if locale is non-english
1 parent a6cd9c2 commit 48df1b8

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

progress.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ flush='tput ed'
5555
# Bash does not handle floats
5656
# This section defines some math functions using awk
5757
# ==================================================
58-
58+
export LC_ALL=C
5959

6060
math::floor() {
6161
#-- This function takes a pseudo-floating point as argument
@@ -71,12 +71,12 @@ math::round() {
7171

7272
math::min() {
7373
#-- Takes two values as arguments and compare them
74-
awk -v f1="$1" -v f2="$2" 'BEGIN{if (f1<=f2) min=f1; else min=f2; printf min "\n"}'
74+
awk -v f1="$1" -v f2="$2" 'BEGIN{if (f1<=f2) min=f1; else min=f2; print min "\n"}'
7575
}
7676

7777
math::max() {
7878
#-- Takes two values as arguments and compare them
79-
awk -v f1="$1" -v f2="$2" 'BEGIN{if (f1>f2) max=f1; else max=f2; printf max "\n"}'
79+
awk -v f1="$1" -v f2="$2" 'BEGIN{if (f1>f2) max=f1; else max=f2; print max "\n"}'
8080
}
8181

8282
math::calc() {

0 commit comments

Comments
 (0)