ruby1.9 examples on ubuntu 8.04, issues. How to fix?

Asked by bothugger

After installing ruby1.9 and ruby1.9-examples on ubuntu 8.04, some of the example programs seem to work and some do not.

For example, biorythm.rb and cal.rb run correctly.

But philos.rb fails with the first error: line 4: require: command not found.
And dir.rb fails with the errors:
 line 3: syntax error near unexpected token `('
 line 3: `dirp = Dir.open(".")'

ruby1.9 and ruby1.9-examples were installed via the synaptic package manager.

I'm wondering if the install is somehow incomplete or is it possible the example programs are not upgraded to be compatible with ruby1.9?
I would like to verify that I have a completely functional ruby install before I start learning ruby. My initial objective is scripting for automating software installs.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu ruby-defaults Edit question
Assignee:
No assignee Edit question
Solved by:
bothugger
Solved:
Last query:
Last reply:
Revision history for this message
bothugger (bothugger) said :
#1

Never mind.
Some of the examples are setup to be run directly from the command line and some are not.

So you can run:
$ ./biorythm.rb
and
$ ./cal.rb
because they both start with this line:
#!/usr/bin/ruby1.9

but dir.rb and philos.rb do not, so to run them you must do:
$ ruby1.9 dir.rb
and
$ ruby1.9 philos.rb