[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Weird (Errno::ENOEXEC

John Doe

12/10/2005 12:05:00 AM

I have a small test case that is giving weird results.

pr.rb contains:
print "Hello!"

if test.rb contains:
`pr.rb > bloop`

then running test.rb from the command line results in bloop getting created
and containing the expected test

if test.rb contains:
`pr.rb`

then running test.rb results in a runtime error:

test.rb:1:in ``': Exec format error - pr.rb

Can anyone explain what is going on? I am using the One Click installer
version 1.8.2-15.


4 Answers

John Doe

12/12/2005 6:33:00 PM

0


Can anyone else recreate this problem with the two scripts below?

"DeZo" <nobody@nowhere.com> wrote in message
news:dnd63r$rcr$1@news.doit.wisc.edu...
>I have a small test case that is giving weird results.
>
> pr.rb contains:
> print "Hello!"
>
> if test.rb contains:
> `pr.rb > bloop`
>
> then running test.rb from the command line results in bloop getting
> created and containing the expected test
>
> if test.rb contains:
> `pr.rb`
>
> then running test.rb results in a runtime error:
>
> test.rb:1:in ``': Exec format error - pr.rb
>
> Can anyone explain what is going on? I am using the One Click installer
> version 1.8.2-15.
>


Kero van Gelder

12/12/2005 10:51:00 PM

0

>> pr.rb contains:
>> print "Hello!"
>>
>> if test.rb contains:
>> `pr.rb > bloop`
>>
>> then running test.rb from the command line results in bloop getting
>> created and containing the expected test

$ ruby test.rb
Warning: unknown mime-type for "Hello!" -- using "application/*"

>> if test.rb contains:
>> `pr.rb`
>>
>> then running test.rb results in a runtime error:
>>
>> test.rb:1:in ``': Exec format error - pr.rb

$ ruby test.rb
test.rb:1: command not found: ./pr.rb

>> Can anyone explain what is going on?

Whatever executes pr.rb (some shell, in my case "bash" in your case??) must
know that pr.rb contains *ruby* code. One way to do that, *nix style, is this:

$ cat pr.rb
#!/usr/bin/env ruby
print "Hello!"
$ cat test.rb
`./pr.rb > bloop`
$ ruby test.rb
$ cat bloop
Hello!

Another is:

$ cat pr.rb
print "Hello!"
$ cat test.rb
`ruby ./pr.rb > bloop`
$ cat bloop
Hello!

Hth,
Kero.

John Doe

12/13/2005 4:39:00 PM

0

> Whatever executes pr.rb (some shell, in my case "bash" in your case??)
> must
> know that pr.rb contains *ruby* code. One way to do that, *nix style, is
> this:
>


I'm running on Windows so I don't need to have the script identify itself.
The extension of .rb causes Windows to automatically invoke the Ruby
interpreter on it. Notice that test.rb works just fine when redirection is
included.

Are there any Windows users who can verify they have the same problem with
the code below?

#############################################################

I have a small test case that is giving weird results.

pr.rb contains:
print "Hello!"

if test.rb contains:
`pr.rb > bloop`

then running test.rb from the command line results in bloop getting created
and containing the expected test

if test.rb contains:
`pr.rb`

then running test.rb results in a runtime error:

test.rb:1:in ``': Exec format error - pr.rb

Can anyone explain what is going on? I am using the One Click installer
version 1.8.2-15.


Bareback Insane O'bungler

12/24/2011 12:37:00 AM

0

On Dec 22, 11:04 pm, "Winston Smith, American Patriot"
<FranzKa...@Oceania.WhiteHouse.GOV.invalid> wrote:
> First. Post <OccupiersDumberThanD...@invalid.net> wrote on Thu 22 Dec 2011
> 10:59:46p
>
>
>
>
>
>
>
>
>
> > On Thu, 22 Dec 2011 19:05:06 +0000 (UTC), "Winston Smith, American
> > Patriot" <FranzKa...@Oceania.WhiteHouse.GOV.invalid> wrote:
>
> >>Psychopathologically disturbed serial liar going by the nym ØBAMAGGOT
> >>ØCCUTARDS wrote:
>
> >>> these are the same Obamaggots that said Bush tax cuts hurt the economy.
>
> >>And you are the same hypocritical piece of shit who gets a thrill from
> >>slapping newborns in the face to make them cry who now is laughing that
> >>160,000,000 Americans will have an economy-hurting tax increase.
>
> > You seem to be in line to be thrilled shitless over Social Security
> > eventually going totally bust thanks to the lack of SSI payroll
> > deductions.
>
> It's a matter of priorities, Elmer.
>
> As SocSec is actually flush with money for the far forseeable future, [pure delusional drivel]

Prove it, shit-eater.
LOL! Run and hide, cunt.