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 =".")'

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

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

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
$ ./cal.rb
because they both start with this line:

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