- Spawn python shell
python3 -c 'import pty; pty.spawn("/bin/bash")'
# if only Python 2:
python -c 'import pty; pty.spawn("/bin/bash")'
python -c 'import subprocess; subprocess.run(["/bin/bash"])'
- When you background the shell (CTRL+Z) after spawning
/bin/bash, use:
stty raw -echo; fg
# if nano or other commands return "Error opening terminal: unknown":
# inside the target shell run this command:
echo $TERM # probably will return 'dumb'
export TERM=xterm # this should fix it
- Now your shell is upgraded.
Script (reliable)
script -qc /bin/bash /dev/null