(+cc: help-bash, -cc: bug-bash, bcc: bug-bash) Hi, QGZ wrote:
> $ cat abc.sh > #!/bin/bash > tput lines > echo $(tput lines) [...] > $ ./abc.sh 2>/dev/null > > We will get : > 50 > 24 This is an ncurses question, not a "bash" question, so let's move to the help-bash list. The tput(1) manual does not describe how it gets access to the terminal to read the number of lines. Fortunately, from your example we can deduce that tput checks if the standard output (file descriptor 1) and standard error (file descriptor 2) streams are terminals and communicates with the terminal using whichever one is a tty. Something like echo $(tput lines 2>/dev/tty) might get your script working again. A patch to the manual page from the ncurses-bin package to clarify this would presumably be welcome. > I don't know why it is. What is amazing is the number 24. That's the traditional height of an 80x24 terminal. Hope that helps. Regards, Jonathan