Send stderr to variable, but send stdout to screen?
On Fri, Dec 14, 2007 at 02:56:36PM -0500, Tony Heal wrote:
> I have an error handling function that traps, reports and exits on an
> error. My problem is that I want to do all of that and I want to
> still see stdout.
> Can anyone help with this? Here is the function. If I change
> sources.list to have an invalid source it reports, but I do not see
> the progress when there is no error.
> # Capture STDERR to ERR
> ERR=$($CMD 2>&1)
2>&1 puts stderr (2) and adds that stream to stdout; they get mixed.
So, you can't see stdout. Just get 2 and ignore 1.
More detailed than that I can't help. I don't do these scripts in sh.
I would use python.
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact email@example.com