0

I'm trying to get terminal resize working inside SSH session, that is spawned by expect, which is spawned by bash.

#!/bin/bash

...
SSH_PASS=XXXXX
SSH_ADDR=YYYYY

expect <(cat << EOD

    trap {
        set rows [stty rows]
        set cols [stty columns]
        stty rows $rows columns $cols < $spawn_out(slave,name)
    } WINCH
    
    spawn ssh $SSH_ADDR
    expect "Password:"
    send -- "${SSH_PASS}\n"
    interact
EOD
)

When terminal is resizing, I'm getting messages like

couldn't open (slave,name): no such file or directory
while executing
"stty rows  columns  < (slave,name)"

So, I assume, var $spawn_out(slave,name), that is created by expect is not visible inside. How it could be achieved? I've tried

global spawn_out

but it doesn't help.

Thanks in advance!

PS: I can't use SSH keys here, it's limitation I can't bypass.

pynexj
  • 19,215
  • 5
  • 38
  • 56

0 Answers0