Using modules when running from shebang! 
Author Message
 Using modules when running from shebang!

I recently installed ruby-mysql from an rpm on linux mdk 8.2. When I run
my program from the command line `shell>./code.rb`, it fails, because it
can't find the module. But when I call it using the interpreter
`shell>ruby code.rb`, it works. How do I fix it so that it works the
first way?

        md |- m:att d:iephouse



Fri, 12 Nov 2004 04:26:38 GMT  
 Using modules when running from shebang!
Hi Matthew,

     I had a similar problem recently, although your problem may be
different than mine, and just have the same symptoms.  After alot of
hair-pulling, I found out thet the shebang line (#!/usr/local/bin/ruby
or whatever) had a CR-LF pair at the end.  Thus, the shell was trying
to find a file named "/usr/local/bin/ruby\r" to run the script, and
failing to find it.  I ran the script file through dos2unix, and it
worked fine.  Your problem may be different, but its worth looking at
it with a binary editor or whatever just in case.

Dennis

---------------------------------------------
|                                           |
|     The way to be happy is to be good     |
|                                           |
---------------------------------------------

Quote:

> I recently installed ruby-mysql from an rpm on linux mdk 8.2. When I run
> my program from the command line `shell>./code.rb`, it fails, because it
> can't find the module. But when I call it using the interpreter
> `shell>ruby code.rb`, it works. How do I fix it so that it works the
> first way?

>    md |- m:att d:iephouse



Mon, 15 Nov 2004 07:56:46 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Strange behavior using a module which uses another module

2. Using Labview 5.1 to run SSR board and modules

3. running a second *.exe while one *.exe is running using Lahey fortran

4. Modules USING Modules?

5. Include files and the Shebang Line

6. More info on the shebang line

7. ignoring the shebang line when invoking from within a linux c++ prog

8. Buggy shebang behavior with different newline style

9. configure shebang paths for apache cgi?

10. shebang strange thing...

11. Local/Module/Global data access at run time

12. Running external EXE from Clipper exe.module

 

 
Powered by phpBB® Forum Software