I have an Expect script which spawn a screen session to read an embedded board console and give respond automatically. I have no issue while executing the Expect script locally in the host.

But when I wish to execute the script from another machine to that host via ssh, for example ssh ubuntu@ './flash-the-board.sh', I will get the prompt

Please set a terminal type

I have try to set TERM=vt100 in the SSH command before running the bash script, end up i got the error

expect: read eof
screen is terminating

Anyone know how to fix this? Thanks

  • 1
    Try ssh -t ubuntu@ './flash-the-board.sh', please. It is a wild guess but easy to check. – andcoz Jun 29 '18 at 8:16
  • i have no control on the ssh part as it is a system that send command to machine. Wish to know any environment configuration i can do in that machine itself – Jeff Pang Jun 29 '18 at 8:32
  • who reported "Please set a terminal type"? – pynexj Jun 29 '18 at 8:47
  • I just found out that the "Please set a terminal type" was prompted when i spawn screen. I have fixed it with added set ::env(TERM) vt100 at the beginning of my Expect script instead of export it before running script. However, i am not sure what is the difference, hopefully someone can explain – Jeff Pang Jun 29 '18 at 8:56
  • why do you need to spawn screen? expect can talk to serial ports directly e.g. github.com/thrig/arduino/blob/master/serial/bytesreader.tcl – thrig Jun 29 '18 at 13:55

Your Answer

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

Browse other questions tagged or ask your own question.