On Wed, Feb 20, 2008 at 10:24 PM, Knute Johnson
<nospam / rabbitbrush.frazmtn.com> wrote:
> Would somebody please try this on Linux for me.  It works fine on
>  Windows but hangs on Fedora.

I ran this script:

true && (
set -x
cat /etc/issue.net
ruby -v
cat ftp.rb
./ftp.rb
) >& output.txt

Here's the content of output.txt:

$ cat output.txt
+ cat /etc/issue.net
Ubuntu 7.10
+ ruby -v
ruby 1.8.6 (2007-06-07 patchlevel 36) [i486-linux]
+ cat ftp.rb
#!/usr/bin/ruby

require 'net/ftp'

def getMetar(id)
    metar = Array.new
    i = 0
    ftp = Net::FTP.new('tgftp.nws.noaa.gov')
    puts ftp.login
    puts ftp.sendcmd('PASV')
    ftp.chdir('/data/observations/metar/stations')
    ftp.gettextfile("#{id.upcase}.TXT") do |line|
        metar[i] = line
        i = i + 1
    end
    ftp.close
    return metar
end

puts getMetar("KBFL")

+ ./ftp.rb
230 Login successful.
227 Entering Passive Mode (140,90,128,71,211,81)
2008/02/21 04:54
KBFL 210454Z 00000KT 10SM CLR 08/06 A3006 RMK AO2 SLP179 T00830061

Regards,
- Robert