While I was getting some old Ruby code of mine out to convert ruby code to pretty HTML-formatted code suitable for blogging from Wolfman’s Howlings I got the following error:
$ ./ruby2html.rb ./ruby2html.rb: line 9: require: command not found ./ruby2html.rb: line 10: require: command not found ./ruby2html.rb: line 11: require: command not found ./ruby2html.rb: line 14: syntax error near unexpected token `(' ./ruby2html.rb: line 14: ` code= File.read(ARGV[0])'
Never saw this problem before, but obviously it was frustrating.
What had happened was I hadn’t deleted the tab spaces before the #!/usr/bin/env ruby line.
Apparently if there is any white space before the #!/usr/bin/env ruby the script will not run.
Swell.. 😐
make sure that first line in ruby code is
#!/opt/sensu/embedded/bin/ruby
That is entirely dependent on the Ruby implementation you are using. For most standard installations the the prolog I showed (at the time of that writing in 2010) was the correct one and still should be today.