I am trying to run a bash script I have via cron, and I am getting the following error at the beginning of the execution:tput: No value for $TERM and no -T specifiedHere is what is in my crontab:0 8 * * 1-5 cd /var/www/inv/ && /var/www/inv/unitTest run all 2>&1| mail -r user@example.com -s Daily Inventory Unit Test Results user@example.com
tput: No value for $TERM and no -T specified
cron;tput
Your unit test script probably calls tput in order to generate pretty output showing which tests pass and fail. Under cron there is no terminal and thus no terminal type ($TERM), so tput cannot control the nonexistent terminal.Your unit test script needs to have 2 modes:running on a terminal: it can call tput to generate pretty-looking outputnot running on a terminal: it should not call tput and instead generate a generic text-only output format that is suitable for piping into an email as you are doing here.The easiest way for the unit tests to know whether or not they are running on a terminal is to test of the stdio file descritors refer to a terminal. If it's a shell script, then:if [ -t 1 ]; then    tput bold; echo pretty; tput sgr0else    echo uglyfiBasically: do not call tput unless you are running on a terminal, and you will thus avoid the error you are getting, plus produce reasonable output in whichever mode you happen to be running under.