Full Interactive Shell

Upgrading to a full interactive shell

  1. spawn bash with python

  2. backgrounding the remote shell

  3. getting rows and columns

  4. ignoring hotkeys in the local shell and getting back to the remote

  5. setting rows and cols for remote shell

  6. adding color

  7. reloading bash to apply TERM variable

python3 -c 'import pty; pty.spawn("/bin/bash")'
^Z
stty -a | head -n1 | cut -d ';' -f 2-3 | cut -b2- | sed 's/; /\n/'
stty raw -echo; fg
stty rows ROWS cols COLS
export TERM=xterm-256color
exec /bin/bash

Last updated