Syntax

Ruby Run a Script Syntax

In Ruby, run a script: runs a Ruby file — ruby script.rb

Quick Answer

Syntax
ruby script.rb
RubySyntax

Run a Script

Code example
ruby script.rb

Runs a Ruby file.

Learn More

How to run a script in Ruby

  1. Open your Ruby file or editor.
  2. Copy the example, then replace its sample names and values for your code.

Ruby Run a Script Syntax

Use ruby script.rb.

Related Syntax References

Frequently asked questions

What is the Ruby syntax for run a script?

Use this pattern: ruby script.rb

Can I copy this Ruby code example?

Yes. Use Copy code and adapt the example to your program.

Is this Ruby syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify