[clug] shell stdout and stderr

David Gibson david at gibson.dropbear.id.au
Thu Dec 1 05:14:40 GMT 2005


On Thu, Dec 01, 2005 at 04:10:39PM +1100, Tony and Robyn Lewis wrote:
> David Gibson wrote:
> 
> >	exec > stdout.out 2> stderr.out
> >
> >i.e. the "exec" shell builtin without specifying a command to exec
> >will apply the given redirections to the current shell.
> > 
> >
> Damn.  Kim was right.  Shared points to David and Kim.
> 
> Now, next question, is how to cancel that redirection and get stdout 
> going back to my terminal.  Clues?

First save your old stdout in a spare file descriptor, say number 3:
	exec 3>&1

The to restore it:
	exec >&3

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson


More information about the linux mailing list