Is it possible to change an element value in CSS via sh script in unix? If so how would this been done?
Aim: I have an html site with multiple div boxes that are coloured based on alarming state, eg.. red, yellow, green.
I have an auto refresh for the HTML site, so all i want to do is to be able to add a line to my current sh scripts to change the css based on results to show the alarming state.
I was thinking using ‘sed’ as per below, but it needs to be element specific and not just change all reds to blues so to speak.
cat test.css | sed -e 's/RED/BLUE/' > test.css
Give your element an id and add a line in the CSS for that id. Then, using sed, change that line.
Say in the HTML the element looks like
and in the CSS this would get its color:
then you change the color via changing the CSS using sed:
or shorter but with advanced sed methods: