redirect to > and to console ?

Tim Hammerquist tim at vegeta.ath.cx
Sat Jul 27 21:50:42 EDT 2002


Steve Holden graced us by uttering:
> "Tim Hammerquist" <tim at vegeta.ath.cx> wrote in message

[ snip ]

>> One thing that concerns me is how well do the COMMAND.COM/CMD.EXE
>> shells handle redirection?  I know that DOS used to support the
>> standard '>' redirection, but I don't remember any robust way of
>> handling stderr on the command line.
>>
>> Various *nix (and cygwin, yes) shells can use:
>>
>>   $ command > file_out 2> file_err
>>
>>   $ command > file_both 2>&1
>>
>>   $ command &> file_both
>>
>> ...and I think I heard CMD.EXE had slightly better support, but how
>> does Win32's native command line stream redirection really compare?
> 
> While I can't be definitive about htis (maybe Mark Hammond *could*),
> one thing it's always worth remebering is that certain Windoze command
> interpreters will fail to handle
> 
>     prog.py > output.txt
> 
> when they *will* cirrectly handle
> 
>     python prog.py > output.txt
> 
> I seem to remember this particular form of brain-death belongs to
> Windows NT 4.0 (why was there never an NT 4.anything else, I wonder),
> since "lesser" operating systems didn't even have the ability to
> associate the ".py" extension with the Ptyhon interpreter.

Yes, I also remember a similar problem with the .BAT file wrappers for
scripts not handling stream redirection properly... that would be the
solution for the Win95/98 systems what don't associate extensions with
programs on the commandline.

<salutation type="arrogant" style="brazen">
<all-the-more-reason-to-get-a-real-OS>'ly yrs,
</salutation>

Tim Hammerquist
-- 
Anyone who thinks that the act of programming is worth
less than $50/hr should leave the industry.
    -- Randal L. Schwartz (clpm, 27 Jul 2000)



More information about the Python-list mailing list