bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Execution strange when get lines of the console in script with comma


From: Chet Ramey
Subject: Re: Execution strange when get lines of the console in script with command substitution and the rediretion of the stderr.
Date: Fri, 25 Nov 2011 22:27:07 -0500
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

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    chet@case.edu    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]