Posted on 02-17-2017 10:36 AM
Hi Jamf Nation
I have a bash script which has some special echo outputs like color, bold etc.
Unfortunately the logs are pretty weird. For example I see a lot of those errors:
tput: No value for $TERM and no -T specified
unable to write 'random state'
Anybody an idea what sort of error this is? The script is working correctly so I think this happens because of the echo commands.
Posted on 02-18-2017 01:18 PM
Post script?
Posted on 02-19-2017 06:16 AM
A shell script I assume?
Do you have !#/bin/sh or !#/bin/bash at the top ?
Try switching it around and the $TERM error might go away.
It's saying it cant find a valid terminal to emulate
Could also try adding
export TERM=xterm
before any output is generated.
Posted on 02-20-2017 02:56 PM
@donmontalvo Unfortunately I can't post the entire script (internal policy) but here are some outputs where the errors occuring:
#!/bin/bash
bold=$(tput bold)
normal=$(tput sgr0)
red=$(tput setaf 1)
green=$(tput setaf 2)
blue=$(tput setaf 4)
echo "${blue}==> ${normal} ${bold}Purge temporary directory${normal}"
echo "${red}Found MAS receipt${normal}"
@john_bio Yes it's shell and a #!/bin/bash at the top. Do you think I should use printf instead of echo?