I am using the following simple function to provide some well readable output to the user. Now I am wondering if there is some kind of (gentoo-/bash-) built-in function to accomplish this task, as this feels like 're-inventing' the wheel. Thanks in advance.
function log
{
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[1;33m'
term='\033[0m'
if [ "$1" == "INFO" ]; then
echo -e "${green}[i] $2 ${term}"
elif [ "$1" == "WARN" ]; then
echo -e "${yellow}[w] $2 ${term}"
elif [ "$1" == "ERROR" ]; then
echo -e "${red}[e] $2 ${term}"
fi
}
$PS[1234]
? – mikeserv Dec 18 '14 at 22:35