Using colours in script 'could not parse JSON (lexical error)'
Hey,
I've just finished writing a script to get the temperatures of my CPU cores. I've noticed that if I use colours in the script like '\e[38;5;198m' the bar crashes and I get the following error:
'Error: Could not parse JSON (lexical error: invalid character inside string.)
But if I remove my colour codes from the script it works fine.
The script works fine from the terminal and only crashes on i3.
I'm also using the degree C symbol as Unicode and it works OK.
From my web development background I'd guess that it isn't being escaped properly but then again this is the first shell script I've written so I could have done something dumb.
Any help would be great.
Code causing the issue:
declare -A format format[none]="\033[38;5;7m" format[good]="\033[38;5;76m" format[bad]="\033[38;5;220m" format[ugly]="\033[38;5;196m"