Added check to use tput only when TERM is set

This prevents lots of errors if a script is run as a cron job