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 [email protected] http://tiswww.cwru.edu/~chet/