commit a6ec71cf55f842517bbd379aeb5e34fbb0583225
parent 511719b71c4278f8cef91fac89380bbb85253861
Author: Frederic Cambus <fred@statdns.com>
Date: Wed, 30 Aug 2017 10:59:34 +0200
Prefer explicit escaping (SC1117)
Diffstat:
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/ansiweather b/ansiweather
@@ -7,7 +7,7 @@
# https://github.com/fcambus/ansiweather #
# #
# Created: 2013-08-29 #
-# Last Updated: 2017-06-21 #
+# Last Updated: 2017-08-30 #
# #
# AnsiWeather is released under the BSD 2-Clause license. #
# See LICENSE file for details. #
@@ -123,11 +123,11 @@ timeformat=$(get_config "timeformat" || echo "%b %d %r")
###[ Colors and characters ]###################################################
-background=$(get_config "background" || echo "\033[44m")
-text=$(get_config "text" || echo "\033[36;1m")
-data=$(get_config "data" || echo "\033[33;1m")
-delimiter=$(get_config "delimiter" || echo "\033[35m=>")
-dashes=$(get_config "dashes" || echo "\033[34m-")
+background=$(get_config "background" || echo "\\033[44m")
+text=$(get_config "text" || echo "\\033[36;1m")
+data=$(get_config "data" || echo "\\033[33;1m")
+delimiter=$(get_config "delimiter" || echo "\\033[35m=>")
+dashes=$(get_config "dashes" || echo "\\033[34m-")
@@ -145,15 +145,15 @@ forecast_text=$(get_config "forecast_text" || echo "forecast")
###[ Unicode Symbols for icons ]###############################################
-sun=$(get_config "sun" || echo "\033[33;1m\xe2\x98\x80")
-moon=$(get_config "moon" || echo "\033[36m\xe2\x98\xbd")
-clouds=$(get_config "clouds" || echo "\033[37;1m\xe2\x98\x81")
-rain=$(get_config "rain" || echo "\033[37;1m\xe2\x98\x94")
-fog=$(get_config "fog" || echo "\033[37;1m\xe2\x96\x92")
-mist=$(get_config "mist" || echo "\033[34m\xe2\x96\x91")
-haze=$(get_config "haze" || echo "\033[33m\xe2\x96\x91")
-snow=$(get_config "snow" || echo "\033[37;1m\xe2\x9d\x84")
-thunderstorm=$(get_config "thunderstorm" || echo "\033[33;1m\xe2\x9a\xa1")
+sun=$(get_config "sun" || echo "\\033[33;1m\\xe2\\x98\\x80")
+moon=$(get_config "moon" || echo "\\033[36m\\xe2\\x98\\xbd")
+clouds=$(get_config "clouds" || echo "\\033[37;1m\\xe2\\x98\\x81")
+rain=$(get_config "rain" || echo "\\033[37;1m\\xe2\\x98\\x94")
+fog=$(get_config "fog" || echo "\\033[37;1m\\xe2\\x96\\x92")
+mist=$(get_config "mist" || echo "\\033[34m\\xe2\\x96\\x91")
+haze=$(get_config "haze" || echo "\\033[33m\\xe2\\x96\\x91")
+snow=$(get_config "snow" || echo "\\033[37;1m\\xe2\\x9d\\x84")
+thunderstorm=$(get_config "thunderstorm" || echo "\\033[33;1m\\xe2\\x9a\\xa1")
@@ -399,7 +399,7 @@ fi
if [ "$ansi" = true ]
then
- env printf "$output\033[0m\n"
+ env printf "$output\\033[0m\\n"
else
- env printf "$output\n" | sed "s/$(printf '\033')\[[0-9;]*m//g"
+ env printf "$output\\n" | sed "s/$(printf '\033')\\[[0-9;]*m//g"
fi