Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I forget where I found this, so if anyone wants to claim attribution, let me know and I'll add a line here. If put into `/etc/profile.d/serial-console.sh`, the following will auto size a serial terminal windows size and create a function for manually adjusting later. Since I access RPIs and BBBs via the serial console, their tty names are already listed in the case statement; add others if your system is different. rsz helps when you later reconnect and minicom or screen is in a different sized window...
- rsz() {
- if [[ -t 0 && $# -eq 0 ]];then
- local IFS='[;' escape geometry x y
- echo -ne '\e7\e[r\e[999;999H\e[6n\e8'
- read -sd R escape geometry
- x=${geometry##*;} y=${geometry%%;*}
- if [[ ${COLUMNS} -eq ${x} && ${LINES} -eq ${y} ]];then
- echo "${TERM} ${x}x${y}"
- else
- echo "${COLUMNS}x${LINES} -> ${x}x${y}"
- stty cols ${x} rows ${y}
- fi
- else
- print 'Usage: rsz'
- fi
- }
- case $( /usr/bin/tty ) in
- /dev/ttyAMA0|/dev/ttyO0|/dev/ttyS0) export LANG=C
- rsz
- ;;
- esac
Add Comment
Please, Sign In to add comment