[ILUG] Re: ILUG digest, Vol 1 #627 - 25 msgs
Michael Conry
michael.conry at ucd.ie
Thu Jan 27 14:44:42 GMT 2000
Just referring to linux in a nutshell, on bash...
to redirect output, you can just do
cmd n> file
n is the file descriptor...0,1 or 2
n=0 is std input stdin
n=1 is std output stdout
n=2 is std error stderr
Kenn's line below will take 2 (stderr) and duplicate it on 1 (stdout), which is then piped to another-cmd.
LiaNutshell also gives the option
cmd &> file
which redirects stderr and stdout to file,
Anyway, hope this helps a little,
mick
ilug-admin at linux.ie wrote:
> Subject: RE: [ILUG] Logging hack wanted
> Date: Thu, 27 Jan 2000 12:08:05 -0000
> From: "Kenn Humborg" <kenn at bluetree.ie>
> To: "Jeremy Smyth" <JSmyth at Saleslan.com>, <ilug at linux.ie>
>
> > Can't pipe the output, because it's sent out on STDERR....
> >
> > So how can I redirect STDERR to STDIN, or sit on STDERR and wait for
> > something to pipe to something else?? Or does anyone have a
> > better solution?
>
> $ cmd 2>&1 | another-cmd
>
> will pipe both stdout and stderr to another-cmd (in bash, that is).
> There is bound to be a magic incantation to pipe stderr only. Try
> the bash manpage for details.
>
> Later,
> Kenn
>
More information about the ILUG
mailing list