Re: exec question

From: Aaron W Morris (aaronmorris@MINDSPRING.COM)
Date: Thu Sep 25 2003 - 18:24:55 EDT


On Thu, 2003-09-25 at 10:01, Bill Verzal wrote:
> Probably a simple question, but I'm at a loss. Google has offered some
> suggestions, but nothing helps.
>
> I have a script that does an "exec 1>filename 2>fileerr".
>
> After the task finishes, how do I re-open stdout and stderr again so I can
> print stuff on the screen (such as end times and stuff) ?
>
> Thanks, Bill.
> --------------------------------------------------------
>
> Bill Verzal
> AIX Administrator, Komatsu America
> (847) 970-3726 - direct
> (847) 970-4184 - fax

Create replica file descriptors so you have a reference to put them back

exec 3>&1 4>&2 1>/dev/null 2>/dev/null
(do some stuff)
exec 1>&3 2>&4
(do some more stuff)

--
Aaron W Morris <aaronmorris@mindspring.com> (decep)


This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:14 EDT