-1

When attempting to run ruby on Linux (ubuntu 14.04) I am not getting a prompt like I do in python (">>>".) Below is an example. I can run the ruby -v to obtain the version information and execute ruby code when the code file is an argument. When I run ruby without any arguments I get nothing and have to break out of it. Any ideas what I am missing?

james@james-Latitude-D830:~$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
james@james-Latitude-D830:~$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
james@james-Latitude-D830:~$ ruby
help()
quit()
^C-: Interrupt

2 Answers2

2

python and ruby are different languages you can open prompt for python using python but incase of ruby you have to use irb to open ruby 'prompt'

james@james-Latitude-D830:~$ irb
2.3.1p112 :001 >  #here you can write your ruby code
dr. strange
  • 665
  • 7
  • 22
0

Ruby's repl is opened with the 'irb' command. Just using ruby would be for calling programs. See this answer for more details - What command opens Ruby's REPL?

or just google ruby repl (read, evaluate, print, loop)

Community
  • 1
  • 1
Anders Elmgren
  • 637
  • 5
  • 12