Thanks.
Andrew
>Is it possible to redirect stderr and not stdout?
Your fingerd does not show which shell you are using, so I can only
advise you to use an sh-like shell (sh, ksh, bash, etc), not the
csh-like shell (csh, tcsh). Try "man ksh" or "man bash" or "man sh".
There should be examples on how to do it.
t.
---------------------------------------------------------------------------
Tony Porczyk * tpor...@infobound.com * San Jose, California
GIT/ED d++$(!d) s++:++ a? C++++ USLB++++$ P+ E--- W(--) N++ !k w-- M- V? b-
PS+++@ PE++ O X-- Y++@ PGP-- t+@ 5++ R* D---- e* V-- h* y** r+++(*)+++(*)>?
---------------------------------------------------------------------------
Yes. To send stderr to file log and not stdout do
foo 2> log
where foo is your command producing output & error. Naturally this will
will not work for csh-type shells.
Pete
in t/csh: from "Csh Programming Considered Harmful" by Tom Christensen:
1. FILE DESCRIPTORS
The most common problem encountered in csh programming is that
you can't do file-descriptor manipulation. All you are able to
do is redirect stdin, or stdout, or dup stderr into stdout.
Bourne-compatible shells offer you an abundance of more exotic
possibilities.
1a. Writing Files
In the Bourne shell, you can open or dup arbitrary file descriptors.
For example,
exec 2>errs.out
means that from then on, stderr goes into errs file.
Or what if you just want to throw away stderr and leave stdout
alone? Pretty simple operation, eh?
cmd 2>/dev/null
Works in the Bourne shell. In the csh, you can only make a pitiful
attempt like this:
(cmd > /dev/tty) >& /dev/null
But who said that stdout was my tty? So it's wrong. This simple
operation *CANNOT BE DONE* in the csh.
Along these same lines, you can't direct error messages in csh scripts
out stderr as is considered proper. In the Bourne shell, you might say:
echo "$0: cannot find $file" 1>&2
but in the csh, you can't redirect stdout out stderr, so you end
up doing something silly like this:
sh -c 'echo "$0: cannot find $file" 1>&2'
--
In k/sh or bash:
command 2>file.stderr
"2" means file descriptor two (well, acually: _file unit number_ two) which
refers to standard error.
-Brian
--
,---. ,---. ,---. ,---. ,---. ,---. ,---.
/ _ \ / _ \ / _ \ / _ \ / _ \ / _ \ / _ \
.' / \ `.' / mailto:bsh2...@challenger.atc.fhda.edu \ `.' / \ `.
__,' `.___,' `.___,' `.___,' `.___,' `.___,' `.___,' `.__
If you are using csh you can redirect stderr and stdout to different places
using
(command > outfile) >& errorfile
But (as Tony pointed out) using other shells is better!
Cheers,
Stewart.