1

when I run the bash script on my Linux machine we get the following errors in my log ,

note - we set in the script:

exec > $log 2>&1 ,  (  in order to send all standard error/output to $log ) 

the errors messages:

tput: No value for $TERM and no -T specified

in order to filter this errors messages we try to set in the bash script that:

export TERM=xterm

but without help

after digging we found that happened in some case for example when we perform ssh to remote machine and runs commands on remote machine VIA ssh

in order to avoid that we set TERM=xterm in the bash script as the following:

ssh user@$remote_machine "TERM=xterm  /tmp/script.sh"

but it’s very not elegant solution and because my script use a lot of ssh and curl command then it’s not practical solution to set this on each SSH or curl etc

so my big question is

how to filter the message – tput: No value for $TERM and no -T specified ?

so we not get these ugly message in my $log file

  • what happens if you run ssh with -t option to force assigning a terminal event for non interactive session? – tonioc Jan 16 '18 at 11:41
0

How about you try to filter it before passing to the log ? Like this maybe ?

exec 2>&1 | egrep -v "tput: No value for $TERM and no -T specified" > $log

Upon reflection, this does not work with exec. Maybe it is better to define this outside the script, i.e. with a wrapper script.

See if this works:

Comment out the exec and log statement from your script, like this

#exec > $log 2>&1 

and execute the script with

/path/to/script.sh 2>&1 | egrep -v "tput: No value for $TERM and no -T specified" > /path/to/log
  • this stay the log file empty in spite script running – enodmilvado Jan 16 '18 at 13:08
  • I just realized that this won't work with exec. maybe try and place this at the end of your script : sed -i '/tput: No value for $TERM and no -T specified/d' $log – Robert Riedl Jan 16 '18 at 13:49
  • not so good because log appears online on the application window also – enodmilvado Jan 16 '18 at 14:27
  • since you seem to have filter out the messages before they are written to the log file, I've added a different method. – Robert Riedl Jan 16 '18 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.