I want a script to output both to stdout and a file. I don't want to
call
the script piped into tee. I want the script to do it itself. I know the
soloution requires the exec command with some funky io redirecrion.
Tnx
--
********************************************************************
Richard Pavlik Shell Canada Limited
Sr. Systems Analyst 400 - 4th Ave. S.W. Rm. 1145
Phone: (403)691-4769 P.O. Box 100, Station M
Fax: (403)269-7505 Calgary, Alberta, Canada
e-mail: Pavlik_Richard/sc...@shell.ca T2P 2H5
********************************************************************
:> Hi, I know this has been answered before, but here is my problem:
I'm not in a position to get to my system and check, but the kind of thing
you're talking about involves creating additional file descriptors using
the exec command. Something like exec 3>file will associate file
descriptor 3 with the named file. The trouble is, individual commands in
your script will still have to be redirected to both stdout and FD 3, or
you'll have to tee each of them. Offhand, I can't think of any way to
open a file descriptor and cause all stdout to go both to 1 and 3. Maybe
someone here can fill in whatever I might be forgetting.
Lotsa luck.
= Steve =
--
Steve W. Jackson
Montgomery, Alabama
sja...@mindspring.com
http://www.mindspring.com/~sjacksn/stevehome.html
Do you believe in Macintosh? Learn how to help the
cause by subscribing to the "EvangeList" listserver!
Send email to <evang...@macway.com> or check out
<http://www.solutions.apple.com/ListAdmin/>.
# Save the stdout and stderr file descriptors for later use
exec 5<&1
exec 6<&2
# Redirect all *default* stdout and stderr to a file. Output that is
specifically
# directed will go to where it is commanded to go. All other output is
# routed to the $ErrMsg file.
exec 1>>$ErrMsg
exec 2>&1
# Reset the stdout and stderr
exec 1>&5
exec 2>&6
Chukk Haselhorst
>Richard Pavlik <Pavlik_Richard/SC...@shell.ca> wrote in article
<342A84...@shell.ca>...