Forrest logo
back to the ruby tool

ruby:tldr:cb294

ruby: Execute a single Ruby command in the command-line.
$ ruby -e ${command}
try on your machine

The command ruby -e ${command} is used for executing a Ruby script or a single line of Ruby code directly from the command line.

Here's a breakdown of the command:

  • ruby: This is the command used to invoke the Ruby interpreter.
  • -e: This option instructs Ruby to execute the following code string as a script argument. It allows you to specify Ruby code directly on the command line.
  • ${command}: This is a placeholder that represents the actual Ruby code you want to execute. You would replace ${command} with your desired Ruby code.

For example, if you want to print "Hello, World!" using this command, you would run:

ruby -e "puts 'Hello, World!'"

The -e option enables you to quickly run simple Ruby code snippets without creating a separate file.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the ruby tool