[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: feature request: capture output of last command and make it availabl
From: |
Greg Wooledge |
Subject: |
Re: feature request: capture output of last command and make it available on some hotkey |
Date: |
Wed, 31 Jul 2013 11:45:37 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Wed, Jul 31, 2013 at 02:09:23AM +0200, Jörn Hees wrote:
> i think this would be a very useful feature and i don't seem to be alone:
> http://stackoverflow.com/questions/5955577/bash-automatically-capture-output-of-last-executed-command-into-a-variable
Bash has no knowledge of, and no way to interact with, commands that
it spawns.
When bash runs a command (e.g. "cat file"), bash merely makes sure that
stdout and the other file descriptors are properly aligned, and then
calls exec(). It is the command itself (cat) which actually does the
writing, and it writes directly to the terminal, or the pipeline, or
wherever stdout is set to go.
Bash can't "capture" this in a variable. Your TERMINAL might be able to
cough up output on demand, but bash is completely unaware of the output.