Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > gets under Windows & Unix

Reply
Thread Tools

gets under Windows & Unix

 
 
William James
Guest
Posts: n/a
 
      05-16-2006
ruby -ne 'print; gets if ARGF.eof' file*

The object is to print line 1 from file 1 and lines 2 through last
from every file.

A perl user alleged that under Unix:

> That will print out the file contents and then wait for more input from stdin
> so you have to follow it with ^D to signal EOF.


Not having access to a Unix or Linux system, I would be grateful
if someone would test this.

 
Reply With Quote
 
 
 
 
ts
Guest
Posts: n/a
 
      05-16-2006
>>>>> "W" == William James <(E-Mail Removed)> writes:

W> A perl user alleged that under Unix:

>> That will print out the file contents and then wait for more input from stdin
>> so you have to follow it with ^D to signal EOF.


no, no : it don't wait for more input from stdin.

it read from stdin *only* if you don't give argument to the command.

--

Guy Decoux
 
Reply With Quote
 
 
 
 
William James
Guest
Posts: n/a
 
      05-16-2006
ts wrote:
> >>>>> "W" == William James <(E-Mail Removed)> writes:

>
> W> A perl user alleged that under Unix:
>
> >> That will print out the file contents and then wait for more input from stdin
> >> so you have to follow it with ^D to signal EOF.

>
> no, no : it don't wait for more input from stdin.
>
> it read from stdin *only* if you don't give argument to the command.



Yes, this is the way it works on my windows 2000 computer.
However, I just tested it on a windows xp computer. After printing
the files, it attempts to read from stdin and I have to press ^Z !

The code in question is
ruby -ne 'print; gets if ARGF.eof' file*

My Ruby version on the xp box is ruby 1.8.2 (2004-05-19)
[i386-mswin32].

Is this a bug in my version of Ruby?


>
> --
>
> Guy Decoux


 
Reply With Quote
 
ts
Guest
Posts: n/a
 
      05-17-2006
>>>>> "W" == William James <(E-Mail Removed)> writes:

W> Is this a bug in my version of Ruby?

Probably or in windows.


--

Guy Decoux
 
Reply With Quote
 
William James
Guest
Posts: n/a
 
      05-17-2006
William James wrote:
> ts wrote:
> > >>>>> "W" == William James <(E-Mail Removed)> writes:

> >
> > W> A perl user alleged that under Unix:
> >
> > >> That will print out the file contents and then wait for more input from stdin
> > >> so you have to follow it with ^D to signal EOF.

> >
> > no, no : it don't wait for more input from stdin.
> >
> > it read from stdin *only* if you don't give argument to the command.

>
>
> Yes, this is the way it works on my windows 2000 computer.
> However, I just tested it on a windows xp computer. After printing
> the files, it attempts to read from stdin and I have to press ^Z !
>
> The code in question is
> ruby -ne 'print; gets if ARGF.eof' file*
>
> My Ruby version on the xp box is ruby 1.8.2 (2004-05-19)
> [i386-mswin32].
>
> Is this a bug in my version of Ruby?



Guy Decoux wrote

> W> Is this a bug in my version of Ruby?


> Probably or in windows.



And apparently this same bug exists in a version of Ruby
running under Unix or Linux, because the Perl-user said
he had to press ^D.

It is pitiful that Ruby can't even execute "gets" properly.

 
Reply With Quote
 
ts
Guest
Posts: n/a
 
      05-18-2006
>>>>> "W" == William James <(E-Mail Removed)> writes:

W> It is pitiful that Ruby can't even execute "gets" properly.

ruby just work fine, this is the P language which is buggy


--

Guy Decoux
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Return of gets gets John Joyce Ruby 0 04-23-2007 01:38 PM
gets gets John Joyce Ruby 2 03-26-2007 04:00 PM
XMLHttpRequest gets data to display in element but data gets appended not replaces previous! libsfan01 Javascript 5 12-20-2006 06:25 AM
Not only the selected HREF gets surrounded, but the whole row gets surrounded Stefan Mueller HTML 5 07-10-2006 11:53 AM
Using Borland C++ Builder under Windows AND Unix? Ramon F Herrera C++ 4 02-05-2005 02:00 PM



Advertisments