From b729a2e291085230b6f3bb14b1e384c0fb1d71f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Kr=C3=BCger?= Date: Wed, 22 Nov 2017 10:32:46 +0100 Subject: [PATCH] Use a safer sed command to avoid locale issues On some locales awk will generate commas instead of dots in the percentage. This will mess up the sed command. Instead of forcing awk to always generate dots we can simply cange the sed command to treat commas as regular text. --- bin/kaleidoscope-builder | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/kaleidoscope-builder b/bin/kaleidoscope-builder index 57442f19..b63ae8da 100755 --- a/bin/kaleidoscope-builder +++ b/bin/kaleidoscope-builder @@ -10,15 +10,15 @@ firmware_size () { ## This is a terrible hack, please don't hurt me. - algernon - MAX_PROG_SIZE=28672 + MAX_PROG_SIZE=28672 - output="$($@ | grep "\\(Program\\|Data\\):" | sed -e 's,^, - ,' && echo)" + output="$($@ | grep "\\(Program\\|Data\\):" | sed -e 's,^, - ,' && echo)" - PROGSIZE="$(echo "${output}" | grep Program: | cut -d: -f2 | awk '{print $1}')" + PROGSIZE="$(echo "${output}" | grep Program: | cut -d: -f2 | awk '{print $1}')" - PERCENT="$(echo ${PROGSIZE} ${MAX_PROG_SIZE} | awk "{ printf \"%02.01f\", \$1 / \$2 * 100 }")" + PERCENT="$(echo ${PROGSIZE} ${MAX_PROG_SIZE} | awk "{ printf \"%02.01f\", \$1 / \$2 * 100 }")" - echo "${output}" | sed -e "s,\(Program:.*\)(\([0-9\.]*%\) Full),\1(${PERCENT}% Full)," + echo "${output}" | sed -e "s/\(Program:.*\)(\([0-9\.]*%\) Full)/\1(${PERCENT}% Full)/" } find_sketch () {