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.