Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > bug in ruby or bug in my brain?

Reply
Thread Tools

bug in ruby or bug in my brain?

 
 
ngoc
Guest
Posts: n/a
 
      08-09-2006
#!/usr/bin/ruby
diff_file = File.open('diff.txt')
diff_file.each { |line|
next if line =~ /^Only/
system "dos2unix #{line.split(' and ').at(1).sub(' differ', '')}"
}
->work well

-------------------
#!/usr/bin/ruby
diff_file = File.open('diff.txt')
diff_file.each { |line|
next if line =~ /^Only/
system("dos2unix", line.split(' and ').at(1).sub(' differ', ''))
}
->problems with converting error message
 
Reply With Quote
 
 
 
 
Yukihiro Matsumoto
Guest
Posts: n/a
 
      08-09-2006
Hi,

I don't know but both caused an exception on my box by using random
diff.txt file.

In message "Re: bug in ruby or bug in my brain?"
on Wed, 9 Aug 2006 16:45:05 +0900, ngoc <> writes:
|
|#!/usr/bin/ruby
|diff_file = File.open('diff.txt')
|diff_file.each { |line|
| next if line =~ /^Only/
| system "dos2unix #{line.split(' and ').at(1).sub(' differ', '')}"
|}
|->work well
|
|-------------------
|#!/usr/bin/ruby
|diff_file = File.open('diff.txt')
|diff_file.each { |line|
| next if line =~ /^Only/
| system("dos2unix", line.split(' and ').at(1).sub(' differ', ''))
|}
|->problems with converting error message

 
Reply With Quote
 
 
 
 
ngoc
Guest
Posts: n/a
 
      08-09-2006
Yukihiro Matsumoto wrote:
> Hi,
>
> I don't know but both caused an exception on my box by using random
> diff.txt file.

My box is Redhat Enterprise Workstation 3.0
Ruby 1.6.8 is already installed in Redhat

My diff.txt is generated when using diff command in linux.
Its output is: Files catalogue_1/A.txt and catalogue_2/A.txt differ
So I use Ruby to pick "catalogue_2/A.txt" out of that string and convert
the file to unix format. (A.txt from server is downloaded to a linux and
a windows machine, after that I want to check A.txt is the same. But it
differs because linux and windows has different ending. So I have to
convert windows ending to unix ending).
>
> In message "Re: bug in ruby or bug in my brain?"
> on Wed, 9 Aug 2006 16:45:05 +0900, ngoc <> writes:
> |
> |#!/usr/bin/ruby
> |diff_file = File.open('diff.txt')
> |diff_file.each { |line|
> | next if line =~ /^Only/
> | system "dos2unix #{line.split(' and ').at(1).sub(' differ', '')}"
> |}
> |->work well
> |
> |-------------------
> |#!/usr/bin/ruby
> |diff_file = File.open('diff.txt')
> |diff_file.each { |line|
> | next if line =~ /^Only/
> | system("dos2unix", line.split(' and ').at(1).sub(' differ', ''))
> |}
> |->problems with converting error message
>

 
Reply With Quote
 
nobu@ruby-lang.org
Guest
Posts: n/a
 
      08-09-2006
Hi,

At Wed, 9 Aug 2006 16:45:05 +0900,
ngoc wrote in [ruby-talk:207244]:
> #!/usr/bin/ruby
> diff_file = File.open('diff.txt')
> diff_file.each { |line|
> next if line =~ /^Only/

line.chomp!
> system("dos2unix", line.split(' and ').at(1).sub(' differ', ''))
> }


--
Nobu Nakada

 
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
[BUG] Ruby 1.9.0: possible bug when subclassing BasicObject Michael Fellinger Ruby 3 12-27-2007 04:05 PM
*bug* *bug* *bug* David Raleigh Arnold Firefox 12 04-02-2007 03:13 AM
#!/usr/bin/ruby , #!/usr/bin/ruby -w , #!/usr/bin/ruby -T?, #!/usr/bin/ruby -T1... anne001 Ruby 1 04-23-2006 03:02 PM
Bug#290705: ruby: Ruby is completly vivisected. Trevor Wennblom Ruby 13 01-16-2005 09:34 PM
Bug in mmap or ruby with ruby-1.8.0 Han Holl Ruby 2 09-01-2003 03:17 PM



Advertisments