Skip to main content
Question

Log from Bash Script


anverhousseini
Forum|alt.badge.img+11

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.

3 replies

donmontalvo
Forum|alt.badge.img+36
  • Legendary Contributor
  • 4293 replies
  • February 18, 2017

Post script?


Forum|alt.badge.img+4
  • Contributor
  • 14 replies
  • February 19, 2017

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.


anverhousseini
Forum|alt.badge.img+11
  • Author
  • Valued Contributor
  • 98 replies
  • February 20, 2017

@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?


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings