Defout vs stdout

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.

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: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================

Hi,

···

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

ummmm. what do you mean by ‘in-place edit’?

-a

···

On Tue, 25 Mar 2003 nobu.nokada@softhome.net wrote:

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.

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================

% 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

 ....
···

In message “Re: defout vs stdout” on 03/03/25, ahoward ahoward@fsl.noaa.gov writes:

On Tue, 25 Mar 2003 nobu.nokada@softhome.net wrote:

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.

ummmm. what do you mean by ‘in-place edit’?

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?

-a

···

On Tue, 25 Mar 2003, Yukihiro Matsumoto wrote:

% 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

 ....

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================

Hi,

···

In message “Re: defout vs stdout” on 03/03/25, ahoward ahoward@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.

yes. finally ( :wink: ).

so, to be safe, $stdout AND $defout should both be redirected when it is
desired that all ‘stdout’ be directed from a script.

-a

···

On Tue, 25 Mar 2003, Yukihiro Matsumoto wrote:

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?

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ahoward@fsl.noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
====================================