On 11/24/11 11:48 AM, QGZ wrote:
> Bash Version: 4.1
> Patch Level: 5
> Release Status: release
>
>
>
> Description:
> When I use "tput lines" to get the lines of console, it works, and
> also works in a script.
> And if execute the command in a script with the command substitution,
> it works well too.
> But if execute the script with the redirection "2>/dev/null", it
> won't work well.
> I'm not sure whether it is a bug or just my lack of some required
> knowledge.
> Please see one example below.
This doesn't have anything to do with bash. tput probably uses the
standard output as a handle to the terminal. When run in a command
substitution, stdout is a pipe. You might take a look at what tput
does using a system call tracer like truss or strace.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/