I'm trying to get the number of columns or lines of my terminal but the variables COLUMNS / LINES are always empty
COLUMNS and LINES are set by BASH only in interactive shells; they do not work in a script. Instead you can use:
COLUMNS=$(tput cols) LINES=$(tput lines)
tput, of course, requires a terminal. On Debian, OpenBSD and HP-UX, tput needs standard output to be a terminal. However, the behavior of tput is non standardized; it is left up to the implementation. It's possible that some operating systems might require standard input to be the terminal device instead (a la stty).
Bash automatically updates the COLUMNS and LINES variables when an interactive shell is resized. If you're setting the variables in a script and you want them to be updated when the terminal is resized, i.e. upon receipt of a SIGWINCH, you can set a trap yourself:
trap 'COLUMNS=$(tput cols) LINES=$(tput lines)' WINCH
You can also set the shell as interactive in the script's shebang:
#!/bin/bash -i echo $COLUMNS