开发者

Is there a way to convert ruby scripts to executable(linuxmint)

Hey guys, I run LinuxMint and I have some scripts which I want to run without terminal, can y开发者_如何学编程ou tell me how?


You need to:

  • Put as the first line of your ruby script the following shebang line (so bash knows what program to use to run this file)

#!/usr/bin/env ruby

  • Make your ruby file executable. In a console you can do this:

chmod 700 my_ruby_file.rb

  • Test that your ruby file is now executable. In a console write:

./my_ruby_file.rb

Notice that we are no longer calling "ruby my_ruby_file.rb", but instead just call the file directly "./my_ruby_file.rb" If your ruby program executed normally, then everything is going well. If it does not execute and shows you an error, then something is not well done from the previous steps (and post your error)

  • In your desktop, create an application link, and point it to the my_ruby_file.rb Once you have the application icon created and shown in your desktop, you can doble-clickit and it will run your application.

Tell us how it went- cheers

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜