From: roktas Date: 2002-03-02T07:29:02+09:00 Subject: Re: Like tail -f * Jean Lacoste [020302 00:13]: > > I have to make a little prog wich works like the "tail -f" command. It > reads a file continuously. > > I tried this : > > #!/usr/local/bin/ruby > > logFileName = "/var/log/messages" > > aFile = File.new(logFileName, "r") > > loop { > v = aFile.gets > if v > puts v > else > select([aFile], nil, nil, nil) > end > } > > > But it loops without stopping on the select line. > Hello, As an urgent help: you have to check the EOF (otherwise results with an infinite loop), instead of loop { .. } try something like this: while (v = aFile.gets) ... end Regards, -- roktas