Ruby/Shell: "puts"/"cat"ing an obscure file messes up terminal -


i tried rewrite bash commands windows in ruby, , trying cat system file totally messes terminal: randomly scrolls (windows) or down (linux)

the file in question one:

http://danyel.apus.uberspace.de/somefile

and ruby program this:

#!/package/host/localhost/ruby-2.0.0/bin/ruby #cat.rb file.open(argv[-1], "r") |f|     puts f.read     f.close end 

if "cat" file (via bash), behaviour turns out totally random, too.

is there reason why that's case?

thanks help,

regards,
danyel.

that file looks database... , if inspect on console you'll see hexadecimal literals. can make 'readable' this:

puts file.read('path/to/file').unpack('h*') 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -