1
0
mirror of https://github.com/speed47/spectre-meltdown-checker synced 2024-11-06 22:23:41 +01:00

fix: --no-color workaround for android's sed

This commit is contained in:
Stéphane Lesimple 2018-02-02 10:59:49 +01:00
parent 8106f91981
commit 6346a0deaa

View File

@ -8,7 +8,7 @@
#
# Stephane Lesimple
#
VERSION='0.34'
VERSION='0.34+'
show_usage()
{
@ -123,7 +123,10 @@ __echo()
if [ "$opt_no_color" = 1 ] ; then
# strip ANSI color codes
_msg=$($echo_cmd -e "$_msg" | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g")
# some sed versions (i.e. toybox) can't seem to handle
# \033 aka \x1B correctly, so do it for them.
_ctrlchar=$($echo_cmd -e "\033")
_msg=$($echo_cmd -e "$_msg" | sed -r "s/$_ctrlchar\[([0-9][0-9]?(;[0-9][0-9]?)?)?m//g")
fi
# shellcheck disable=SC2086
$echo_cmd $opt -e "$_msg"