Alex Rivera | Logout

How to check syntax of ruby script that has script/runner as a shebang?

Asked 2011-09-12T06:46:58.877
20

I have problems to check syntax of ruby scripts that has rails script/runner on its shebang.

Here are two example scripts and how they responses to ruby syntax checking:

Script hello_world_runner.rb:

#!/usr/bin/env script/runner
p "Hello world!"

Script hello_world.rb

#!/usr/bin/env ruby
p "Hello world!"

Here is how I try to check the syntax. First line is a command and a second line is an output.

$ ruby -c hello_world_runner.rb 
"Hello world!"

$ ruby -c hello_world.rb 
SYNTAX OK
Edit
Report

1 Answer

14

You can try this

tail -n +2 hellow_world_runner.rb | ruby -c

Not ideal but should work.

answered 2011-11-08T11:20:31.510

Your Answer