Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

defout vs stdout

0 views
Skip to first unread message

ahoward

unread,
Mar 24, 2003, 6:36:38 PM3/24/03
to

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

nobu....@softhome.net

unread,
Mar 24, 2003, 6:59:19 PM3/24/03
to
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

ahoward

unread,
Mar 24, 2003, 9:10:39 PM3/24/03
to nobu....@softhome.net

<dumb>

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

</dumb>

Yukihiro Matsumoto

unread,
Mar 24, 2003, 10:36:55 PM3/24/03
to

In message "Re: defout vs stdout"

on 03/03/25, ahoward <aho...@fsl.noaa.gov> writes:
|
|On Tue, 25 Mar 2003 nobu....@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.
|
|<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

....

ahoward

unread,
Mar 24, 2003, 10:58:09 PM3/24/03
to
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
>
> ....

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?

Yukihiro Matsumoto

unread,
Mar 24, 2003, 11:06:56 PM3/24/03
to
Hi,

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.

ahoward

unread,
Mar 24, 2003, 11:12:46 PM3/24/03
to
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?

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.

0 new messages