bug-bash
[Top][All Lists]
Advanced

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

Re: Feature request or advice on implementation for buffering command ou


From: Chet Ramey
Subject: Re: Feature request or advice on implementation for buffering command output
Date: Wed, 27 Mar 2019 14:18:55 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

On 3/27/19 3:49 AM, Anders Brujordet wrote:
> Usecase:
> You run a command, the output is displayed in your terminal. Now that you
> see the output, you would like to grab say an ID from this output. Instead
> of coping and pasting the output, I would like to be able to do something
> like:
> # grep 'the thing that you want' <<< ${COMMAND_OUTPUT} | ./some_script
> 
> Where COMMAND_OUTPUT is the last n number of output lines from the previous
> command.
> 
> Now, I've looked at several ways of implementing this is Bash. They all
> break in various ways, because it usually means pushing all output to a
> file/variable and then pushing it to stdout. Would it be feasible to have
> Bash tee off anything intended for stdout to a variable?

In general, no.  Keep in mind that the majority of output is performed by
external commands executed in subshells anyway.


-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/



reply via email to

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