Re: bash: capturing the stdout/stderr of a cmd to system log?

From: <captgoodnight@acsalaska.net>
Date: Thu Jul 01 2004 - 21:37:13 AKDT

On Thursday 01 July 2004 08:51 pm, bryan@ak.net wrote:
> On Thu, Jul 01, 2004 at 09:25:24AM -0800, Thomison, Lee <ThomisonL@ci.anchorage.ak.us> wrote:
> > As an alternative, is there a way to redirect stdout and stderr to a
> > variable in the bashscript, rather than a file?
>
> You can use backquote substitution to capture the output:
> SHELLVAR=`scp blahblah`
>
> I suppose you could throw a 2>&1 in there too.

hmmmm, here's here.

yup=`scp foo captgoodnight@192.168.*.*:/home/captgoodnight`
echo "$yup"

yup=`scp food captgoodnight@192.168.*.*:/home/captgoodnight`
food: No such file or directory
echo "$yup"

or

yup=$(scp food captgoodnight@192.168.*.*:/home/captgoodnight)
food: No such file or directory
echo "$yup"

yup=$(scp foo captgoodnight@192.168.*.*:/home/captgoodnight)
echo "$yup"

> I suppose you could throw a 2>&1 in there too

Catches failure, but not success. That's here though. You different?

I'm missing something huh? Please school me if so.

eddie

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Thu Jul 1 21:37:30 2004

This archive was generated by hypermail 2.1.8 : Thu Jul 01 2004 - 21:37:31 AKDT