[clug] shell stdout and stderr

Tony and Robyn Lewis beakysnugger at yahoo.co.uk
Thu Dec 1 06:12:52 GMT 2005

Kim Holburn wrote:

> I *think* the simplest way is to use a sub shell.  Gets around all  
> those save environemt - mess it up - restore things:
> stuff
> stuff
> (
>   exec > ...
>   stuff
> )
> # back to old environment.
> Could be wrong here though.

Nice idea, but I'm setting the redirection in the main body of the 
script, and cancelling it in a function that hangs off a trap (so I can 
still log stuff that gets interrupted / killed or otherwise signalled).

 David's idea came up trumps though.

Ta all.


More information about the linux mailing list