[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: -e oneliners with File.open
From:       Kent Dahl <kentda () stud ! ntnu ! no>
Date:       2002-05-22 14:20:12
[Download RAW message or body]

Tobias Reif wrote:
> ruby -e 'File.open("foo.txt","w") do |f|; f.write 6; end'
> 
> (the string to write was different, but the above is enough to reproduce
> the error)
> but got
> 
> -e:1: parse error

<SNIP>
[kentda@v052a tmp]$ ruby -e 'File.open("foo.txt","w") do |f|; f.write 6;
end'
[kentda@v052a tmp]$ less foo.txt 
6
[kentda@v052a tmp]$ ruby --version
ruby 1.6.6 (2001-12-26) [i586-linux-gnu]
[kentda@v052a tmp]$ ruby -e 'File.open("delete.txt", "w") do |file|
   # 100 000 lines with 1 000 xs =~ 100 MB
   file.write((("x"*1000)+"\n")*100000)
end'
</SNIP>

Hmm, no problem here... What version are you using? 

-- 
(\[ Kent Dahl ]/)_    _~_    __[ http://www.stud.ntnu.no/~kentda/ ]___/~
 ))\_student_/((  \__d L b__/  NTNU - graduate engineering - 4. year  )
( \__\_õ|õ_/__/ ) _)Industrial economics and technological management(
 \____/_ö_\____/ (____engineering.discipline_=_Computer::Technology___)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic