Bug in ruby or bug in my brain?

#!/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

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 [email protected] 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

Yukihiro M. 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).

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!