14.6. Issuing system commands from inside Ruby programs

You can issue system commands in several ways in Ruby. We’ll look primarily at two of them: the system method and the `` (backticks) technique. The other ways to communicate with system programs involve somewhat lower-level programming and are more system-dependent and therefore somewhat outside the scope of this book. We’ll take a brief look at them nonetheless, and if they seem to be something you need, you can explore them further.

14.6.1. The system method and backticks

The system method calls a system program. Backticks (``) call a system program and return its output. The choice depends on what you want to do.

Executing system programs with the system method

To use system, send it ...

Get The Well-Grounded Rubyist, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.