[clug] shell stdout and stderr

David Gibson david at gibson.dropbear.id.au
Thu Dec 1 04:34:44 GMT 2005

On Thu, Dec 01, 2005 at 03:28:13PM +1100, Tony and Robyn Lewis wrote:
> Arafangion wrote:
> >I don't understand what you mean - what don't you want about the following:
> >
> >arafangion at therock:~$ cat test
> >#!/bin/bash
> >/test
> >arafangion at therock:~$ ./test 2> test.out
> > 
> >
> Here's the problem (above).  I don't want to specify the redirection on 
> the command line - I want it to be set up and enacted from within the 
> script.

	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.

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_!

More information about the linux mailing list