I executed following code on bash on the terminal which have LINES=50. The result of 'tput lines' command varied. I have no idea to explain this results. Why the 'tput lines' command may returns '24' ?
The code:
#!/bin/sh
echo $LINES
tput lines
tput lines 2>/dev/null
echo $(tput lines)
echo $(tput lines 2>/dev/null)
true && tput lines
true && tput lines 2>/dev/null
true && echo $(tput lines)
true && echo $(tput lines 2>/dev/null)
echo $TERM
echo $TERM 2>/dev/null
echo $(echo $TERM)
echo $(echo $TERM 2>/dev/null)
true && echo $TERM
true && echo $TERM 2>/dev/null
true && echo $(echo $TERM)
true && echo $(echo $TERM 2>/dev/null)
The result 1:
$ ./testtput
50
50
50
24
50
50
50
24
xterm-256color
xterm-256color
xterm-256color
xterm-256color
xterm-256color
xterm-256color
xterm-256color
xterm-256color
The result 2:
$ ./testtput | pbcopy
50
24
50
24
50
24
50
24
xterm-256color
xterm-256color
xterm-256color
xterm-256color
xterm-256color
xterm-256color
xterm-256color
xterm-256color
My environment:
- Mac mini late 2018
- MacOS 11.4
- The result of 'uname -a' is
Darwin hogehoge.local 20.5.0 Darwin Kernel Version 20.5.0: Sat May 8 05:10:33 PDT 2021; root:xnu-7195.121.3~9/RELEASE_X86_64 x86_64
- The $BASH_VERSION is
3.2.57(1)-release