From: kk_oop on
Hi. I am using a Bourne script like this:

myscript.sh >& myoutput.out

Instead of doing this, is there a command I can put inside my script to
cause it to redirect output in this way?

Thanks!

Ken

From: Stephane Chazelas on
On 7 Mar 2006 04:26:57 -0800, kk_oop(a)yahoo.com wrote:
> Hi. I am using a Bourne script like this:
>
> myscript.sh >& myoutput.out
>
> Instead of doing this, is there a command I can put inside my script to
> cause it to redirect output in this way?
[...]

#! /bin/sh -
exec > myoutput.out 2>&1
# the remaining of your script goes here


or

#! /bin/sh -
{
# your script goes here
} > myoutput.out 2>&1

Note that if myoutput.out can't be open for writing, the script
will stop at once and not do anything (which is probably what
you want).

--
Stephane