I am doing a basic script to check if services are disabled, and I was wondering how to change to colours for PASS and FAIL to green & red respectively.
#!/usr/bin/bash
clear
TELNET=`svcs -a | grep telnet | awk '{print $1}'`
if [ "$TELNET" == "disabled" ]
then
RESULT=PASS
else
RESULT=FAIL
fi
echo -e "Verifying if Telnet services are disabled [$RESULT]"
FTP=`svcs -a | grep ftp | awk '{print $1}'`
if [ "$FTP" == "disabled" ]
then
RESULT2=PASS
else
RESULT2=FAIL
fi
echo "Verifying if FTP services are disabled [$RESULT2]"
That doesn't work on at least one of the systems I use. There are two different versions of tput. One uses termcap, the other terminfo. They are not compatible.
On the other hand, the ISO 6429 standard (also known as ECMA-48, and formerly known as ANSI X3.64), is ubiquitous, and terminals that do not support it are few and far between.