1
0
mirror of https://github.com/speed47/spectre-meltdown-checker synced 2024-12-22 12:23:36 +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 # Stephane Lesimple
# #
VERSION='0.34' VERSION='0.34+'
show_usage() show_usage()
{ {
@ -123,7 +123,10 @@ __echo()
if [ "$opt_no_color" = 1 ] ; then if [ "$opt_no_color" = 1 ] ; then
# strip ANSI color codes # 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 fi
# shellcheck disable=SC2086 # shellcheck disable=SC2086
$echo_cmd $opt -e "$_msg" $echo_cmd $opt -e "$_msg"