Forum: Ruby Executing a shell command from within a ruby script?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Paatsch, Bernd (Guest)
on 2006-05-27 01:33
(Received via mailing list)
Hello,

I am fairly new to ruby and I like to have a script that can Executing a
shell command from within a ruby script like "gem list --local"
How would I do that?

Thanks,
Bernd
Logan C. (Guest)
on 2006-05-27 01:43
(Received via mailing list)
On May 26, 2006, at 5:32 PM, Paatsch, Bernd wrote:

> Hello,
>
> I am fairly new to ruby and I like to have a script that can
> Executing a
> shell command from within a ruby script like "gem list --local"
> How would I do that?
>
Check out the system method, and back ticks (x = `gem list --local`).
If you need somethin more complicated, look into IO.popen.
This topic is locked and can not be replied to.