Guest User

Untitled

a guest
Dec 5th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. 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...
  2.  
  3. rsz() {
  4. if [[ -t 0 && $# -eq 0 ]];then
  5. local IFS='[;' escape geometry x y
  6. echo -ne '\e7\e[r\e[999;999H\e[6n\e8'
  7. read -sd R escape geometry
  8. x=${geometry##*;} y=${geometry%%;*}
  9. if [[ ${COLUMNS} -eq ${x} && ${LINES} -eq ${y} ]];then
  10. echo "${TERM} ${x}x${y}"
  11. else
  12. echo "${COLUMNS}x${LINES} -> ${x}x${y}"
  13. stty cols ${x} rows ${y}
  14. fi
  15. else
  16. print 'Usage: rsz'
  17. fi
  18. }
  19.  
  20.  
  21. case $( /usr/bin/tty ) in
  22. /dev/ttyAMA0|/dev/ttyO0|/dev/ttyS0) export LANG=C
  23. rsz
  24. ;;
  25. esac
Add Comment
Please, Sign In to add comment