LE. I killed everything html related. Declared 2 variables R and G (for red and green).
My mail shows the status [0;32mGLOBAL_STATUS = OK, obvious not in colours.
If I comment my variables I receive in the email GLOBAL_STATUS = OK -> no colours.
Pretty please help me receive the mail with green GLOBAL_STATUS = OK
I wrote this part of the code, but it doesn’t print in the email I should receive: GLOBAL_STATUS = OK in green ☹
It shows on top of the email: <h1> <span style='color:green;'> GLOBAL_STATUS = OK </span></h1><br/><br/><br/>
And at the end of the email: <html>
<body>
<br><br><br> </body> </html>
What am I doing wrong? I tried to eliminate the html, body, etc parts, but still, the beginning of the mail is the same: <h1> <span style='color:green;'> GLOBAL_STATUS = OK </span></h1><br/><br/><br/>
#echo "<html> ">>$LOG #echo "<body>" >> $LOG #echo "<br><br><br>" >> $LOG #echo "<br><br><br>" >> $LOG R='\033[0;31m' G='\033[0;32m' content="tmp.txt" global_status=0 while read line; do if [[ "$line" == *"KO"* && "$global_status" == "0" ]]; then echo -e "\n\n\n $line"; ((global_status=!global_status)); echo -e "\n $global_status" fi echo "$line" >> $content done < $LOG #echo "<h1>" > $LOG if [ "$global_status" -eq 0 ]; then echo -e "${G}GLOBAL_STATUS = OK" > $LOG else echo -e "${R}GLOBAL_STATUS = KO" > $LOG fi cat $content >> $LOG rm tmp.txt #echo "</body>" >> $LOG #echo "</html>" >> $LOG mail -s "Check Back" [email protected] < /home/check_back.log
echo "<h1>" > $LOG
should readecho "<h1>" >> $LOG
, otherwise you are overwriting everything written to the file so far.$LOG
both as mail body and status control (in while loop) ?