Redirecting dump output (SunOS 101)

2007-12-25 9:05:00

Well, it seems everybody but me knew the answer to this one! The question

was how do you redirect the output from dump to a file? Here's the answer:

      dump_command > file_you_want_to_write_to 2>&1

The reason this works and plain ol' ">" doesn't is because dump echoes its

output to stderr NOT stdout. Why? No one knows. I checked the man pages

before putting this question on the airwaves, but I didn't know how close I

was to the answer. I looked again and found the relevant part in the SH(1)

man page. To wit:

--START OF MAN PAGE EXCERPT--

        <word blah blah...

>word blah blah...

>>word blah blah...

        <<[-]word blah blah...

        <&digit blah blah...

        <&- blah blah...

        

(Here's the fun part)

If any of the above is preceded by a digit, the file descriptor which will

be associated with the file is that specified by the digit (instead

of the default 0 or 1). For example:

        ... 2>&1

associates file descriptor 2 with the file currently associated

with file descriptor 1.

--END OF MAN PAGE EXCERPT--

This says nothing about stdout or stderr. I'm assuming file descriptor 1 is

stdout and 2 is stderr. When I read that the first time it left me totally

confused. It still does. Anyway, I put the "2>&1" thingy in my borne shell

script and everything is humming nicely. A zillion thanks to the zillion

people who answered my question.

               [~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~]

               [ Gary Swofford ]

               [ DynCorp I & ET - Hampton VA USA ]

               [ g.l.swofford@LaRC.NASA.GOV ]

               [_________________________________]

Comments

Got something to say?

You must be logged in to post a comment.