Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using 'ruby' with no arguments freezes terminal

Tags:

ruby

I'm a Ruby newbie and have Ruby 1.9.3 installed on an Ubuntu 12.04 machine.

Whenever I run the ruby command in the terminal with no arguments, it just hangs and does nothing. It does the same thing on my Windows XP installation.

Is this the expected behavior? Coming from a Python/Java background I expected some kind of output.

like image 369
user886596 Avatar asked Feb 24 '13 15:02

user886596


1 Answers

This is expected. When you run just ruby, it sits there, waiting for a program from STDIN, followed by an end-of-file character, after which it executes the program.

If you want interactive, like when you run python, you want Ruby's irb.

like image 197
Linuxios Avatar answered Sep 22 '22 10:09

Linuxios