Skip to content

Commit 95a98c7

Browse files
committed
fix: replace bc with awk for computations
awk is always available, bc is not.
1 parent 026dea1 commit 95a98c7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

action.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ runs:
135135
formatByteCount() {
136136
bytes=$1
137137
if [ "$bytes" -lt "0" ]; then
138-
kilobytes=$(echo "-$1 * 1000" |bc -l )
138+
kilobytes=$(awk "BEGIN {printf \"%.2f\", -$1 * 1000}")
139139
else
140-
kilobytes=$(echo " $1 * 1000" |bc -l )
140+
kilobytes=$(awk "BEGIN {printf \"%.2f\", $1 * 1000}")
141141
fi
142-
echo $(numfmt --to=iec-i --suffix=B --padding=7 ${kilobytes});
142+
echo $(numfmt --to=iec-i --suffix=B --padding=7 ${kilobytes});
143143
}
144144
145145
# macro to output saved space
@@ -154,7 +154,6 @@ runs:
154154
RATE=$(awk "BEGIN {printf \"%.2f\", ( $saved / 1000000.0 ) /($time + $epsilon)}")
155155
gigabytes_saved=$(formatByteCount $saved)
156156
gigabytes_saved=$(formatByteCount $saved)
157-
echo ":$gigabytes_saved:$saved:$time:$title:"
158157
echo "=> ${title}: Saved $gigabytes_saved: in ${time} seconds : rate = ${RATE} GB/sec"
159158
printSeparationLine '*' 80
160159
echo ""

0 commit comments

Comments
 (0)