sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

D1565.test-bash-sigwinch.sh (352B)


      1 #!/bin/bash
      2 
      3 shopt -s checkwinsize
      4 
      5 function trapwinch {
      6   local size=${COLUMNS}x${LINES}
      7   echo "WINCH-START ($size)"
      8   for i in {0..100}; do
      9     sleep 0.01
     10     local new_size=${COLUMNS}x${LINES}
     11     if [[ $new_size != "$size" ]]; then
     12       echo "SIZE CHANGED i=$i ($size)"
     13       size=$new_size
     14     fi
     15   done
     16   echo WINCH-END
     17 }
     18 
     19 trap trapwinch WINCH