tags:

views:

110

answers:

2

There is a command I want to call that returns a string, I want to call this command while inside a ruby script, and have access to the result.

+2  A: 

I am assuming by command you mean an OS command.

# this will execute ls and assign the dir listing to the variable
dir_list = `ls` 
os_user  = `whoami`
KandadaBoggu
KandadaBoggu, it's you! You beat me to it! (+1)
macek
@smotchkkiss Low hanging fruit :-). Damn this game is addictive.
KandadaBoggu
A: 

you have the method Kernel#system too http://ruby-doc.org/core/classes/Kernel.html#M005971

system "dir"
shingara