|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
|
Re: [PLUG] changing stdout in a script
|
On Wednesday 07 January 2004 06:07 pm, mjd-lists-plug@plover.com wrote:
> Jeff Abrahamson <jeff@purple.com>:
> > Can a shell script change where stdout goes?
> >
> > I have a shell script that creates a directory. I would like to have
> > echo and all other instances of output to stdout go to a file in this
> > directory.
> >
> > Of course, I could do this with two scripts, one of which is a
> > wrapper. Does anyone know a way to do this with just one script?
>
> exec >the-file
>
> will redirect the standard output.
>
> If you will want to put it back the way it was later on, you may
>
> exec 3>&1 >the-file
>
> before and
>
> exec 1>&3 3>&-
>
> after.
Can't he just use the command 'script' to do this? You run that and
everything gets logged to a file. Or am I missing the conversation?
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|