Summary #2:the dump command and redirection

From: GARY L 'GARY' SWOFFORD (G.L.SWOFFORD@larc.nasa.gov)
Date: Tue Jun 27 1995 - 02:04:18 CDT


It seems my first summary on this subject provoked quite a few responses!
For those coming in late, let me bring you up to date.

Original questions: How do you redirect messages that dump spits out? Using
">" doesn't seem to work. How do I keep my dump script from sending me mail?

Original answer: The dump command sends its messages to standard error
instead of standard output. So, rather than using ">" you should use "2>".
This solves both problems. Redirecting the standard error creates the
logfile I want and prevents mail from being sent.

This answer caused me to casually ask a few more questions.

Next questions: Why does the dump command output messages to standard
error rather than standard output? What is the deal with these nutty file
descriptors and redirection (i.e. "2>" "2>&1" etc)?!

Humbling answers: I'll let some of the answerers have a go at this.

Casper Dik on dump message output:
I know why dump writes to stderr, I assume more people do (they do - Gary).
It allows you to dump to a pipe:

        dump 0f - | rsh foo 'cd /blah; restore rf -'

Now if you get the "DUMP:" message on stdout, restore won't be able to make
sense of the dump file.

John Rosenberg on file descriptors:
Since the beginning of (UNIX) time (1960-something), well before stdio was
invented, file handle 0 has been stdin, 1 stdout, 2 stderr. Rather similar to
how Fortran has always had "standard" file numbers, although of course they
were (are) different on every machine in the world.

It all sounds so simple when you read the answers. Thanks to everyone for
setting me straight!

               [~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]
               [ Gary Swofford ]
               [ DynCorp I & ET - Hampton VA USA ]
               [ g.l.swofford@LaRC.NASA.GOV ]
               [_________________________________]



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:10:28 CDT