How can I run the OS X command say
(man page) inside a Ruby shell script without exiting that script? The advice in the thread Calling shell commands from Ruby doesn't seem to apply.
Asked
Active
Viewed 1,690 times
2 Answers
3
You want
`say "#{var_name}"`
If you find backticks hard to read
%x(say "#{var_name}")
This would work as well:
system "say", var_name

glenn jackman
- 238,783
- 38
- 220
- 352
1
You can do it like this:
message = "Hello world"
`say "#{message}"`

Tim Destan
- 2,028
- 12
- 16
-
Thanks! But how do I do variable expansion with that? (e.g., `say variable_name`) – hjkml Nov 13 '14 at 01:20