1

There is a operation of terminal (osx) called say. If I type say hello, the terminal uses voice control to say hello.

I want to access this command from my ruby script. Any idea how I can say hello from my ruby script?

1 Answers1

2

The most simplistic way to call commands from ruby is with backticks.

For example,

def say_hello
    `say hello`
end

Would run the command say hello in terminal.

Testing this in IRB causes the computer to say "Hello".

You might want to look into alternate methods of calling the command line though, as backticks aren't the most secure.

Cereal
  • 3,699
  • 2
  • 23
  • 36