redirect sysout and syserr to same file?

G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.newusers (More info?)

I know

type foo >a.s puts foo into a.s
type foo 2>a.s puts errors into a.s

but what if I want both into the same file?

type foo >a.s 2>a.s doesn't work, neither does
type foo 1>a.s 2>a.s

i can send them to separate files and concatenate - but what a hack

thanks
/j
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.newusers (More info?)

Jeff W wrote:
> I know
>
> type foo >a.s puts foo into a.s
> type foo 2>a.s puts errors into a.s
>
You might try f >a.s 2>&1. It works under bash. Maybe it'll work on MS.
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.newusers (More info?)

Jeff W wrote:
> I know
>
> type foo >a.s puts foo into a.s
> type foo 2>a.s puts errors into a.s
>
> but what if I want both into the same file?
>
> type foo >a.s 2>a.s doesn't work, neither does
> type foo 1>a.s 2>a.s
>
> i can send them to separate files and concatenate - but what a hack
>
> thanks
> /j

type foo>a.s 2>&1

The >& operator writes the output from one handle to the input of
another handle. So in the above the output of stderr is redirected to
stdout, which is then redirected to a.s.
--
Tom Porterfield
MS-MVP Windows
http://support.telop.org

Please post all follow-ups to the newsgroup only.
 
G

Guest

Guest
Archived from groups: microsoft.public.windowsxp.newusers (More info?)

thanks guys


Tom Porterfield wrote:

>Jeff W wrote:
>> I know
>>
>> type foo >a.s puts foo into a.s
>> type foo 2>a.s puts errors into a.s
>>
>> but what if I want both into the same file?
>>
>> type foo >a.s 2>a.s doesn't work, neither does
>> type foo 1>a.s 2>a.s
>>
>> i can send them to separate files and concatenate - but what a hack
>>
>> thanks
>> /j
>
>type foo>a.s 2>&1
>
>The >& operator writes the output from one handle to the input of
>another handle. So in the above the output of stderr is redirected to
>stdout, which is then redirected to a.s.
>
>