thanks alot.
-a
--
====================================
| Ara Howard
| NOAA Forecast Systems Laboratory
| Information and Technology Services
| Data Systems Group
| R/FST 325 Broadway
| Boulder, CO 80305-3328
| Email: aho...@fsl.noaa.gov
| Phone: 303-497-7238
| Fax: 303-497-7259
====================================
At Tue, 25 Mar 2003 08:40:42 +0900,
ahoward wrote:
> can some definitively explain these? i've read over many of the old posts and
> can accomplish what i need to do, but am not *crystal* clear on this.
STDOUT is stdout of the process, DEFOUT is output for in-place
edit.
--
Nobu Nakada
<dumb>
ummmm. what do you mean by 'in-place edit'?
</dumb>
% man ruby
....
-i extension
Specifies in-place-edit mode. The extension, if specified, is added to old filename to make a
backup copy. For example:
% echo matz > /tmp/junk
% cat /tmp/junk
matz
% ruby -p -i.bak -e '$_.upcase!' /tmp/junk
% cat /tmp/junk
MATZ
% cat /tmp/junk.bak
matz
....
> % man ruby
>
> ....
>
> -i extension
> Specifies in-place-edit mode. The extension, if specified, is added to old filename to make a
> backup copy. For example:
>
> % echo matz > /tmp/junk
> % cat /tmp/junk
> matz
> % ruby -p -i.bak -e '$_.upcase!' /tmp/junk
> % cat /tmp/junk
> MATZ
> % cat /tmp/junk.bak
> matz
>
> ....
this is what i *thought* was meant by 'in-place', but many, many, threads have
discussed $defout simply as a means of redirecting/dupping/etc the stdout of a
process.
is this an abuse then? it would seem so since it looks as if
if '-p' and '-i' and ARGV[0]
$defout = open ARGV[0], 'w'
else
$defout == $stdout
end
??
is there ever a good reason to directly modfiy $defout directly then?
In message "Re: defout vs stdout"
on 03/03/25, ahoward <aho...@fsl.noaa.gov> writes:
|this is what i *thought* was meant by 'in-place', but many, many, threads have
|discussed $defout simply as a means of redirecting/dupping/etc the stdout of a
|process.
|
|is this an abuse then?
No. $defout is a "default output of print/printf etc." and -i replace
the input file by $defout output (after making backup). Does this
make sense?
matz.
> |this is what i *thought* was meant by 'in-place', but many, many, threads have
> |discussed $defout simply as a means of redirecting/dupping/etc the stdout of a
> |process.
> |
> |is this an abuse then?
>
> No. $defout is a "default output of print/printf etc." and -i replace
> the input file by $defout output (after making backup). Does this
> make sense?
yes. finally ( ;-) ).
so, to be safe, $stdout AND $defout should both be redirected when it is
desired that all 'stdout' be directed from a script.