Run a command on shell with ruby

hi guys,

i want to run a command with a ruby programme. for example, assume that
i have a ruby script and when run its, it make “apt-get install gaim”
command run…

what is the method or way of that ?
thanks

ok i got it. and i am giving an example for who want to know

#! /usr/bin/ruby
exec “apt-get install gaim”;

this script run that command on shell

Corpus C. wrote:

hi guys,

i want to run a command with a ruby programme. for example, assume that
i have a ruby script and when run its, it make “apt-get install gaim”
command run…

what is the method or way of that ?
thanks

On 5/19/07, Corpus C. [email protected] wrote:

hi guys,

i want to run a command with a ruby programme. for example, assume that
i have a ruby script and when run its, it make “apt-get install gaim”
command run…

what is the method or way of that ?
thanks

system “apt-get install gaim”

I’d recommend using pidgin – it’s the newest release of gaim.

TwP

Corpus C. wrote:

hi guys,

i want to run a command with a ruby programme. for example, assume that
i have a ruby script and when run its, it make “apt-get install gaim”
command run…

what is the method or way of that ?
thanks

Use the Kernel#system method, or surround the command with backticks.

system(“apt-get install gaim”)
apt-get install gaim

On 5/19/07, Corpus C. [email protected] wrote:

hi guys,

i want to run a command with a ruby programme. for example, assume that
i have a ruby script and when run its, it make “apt-get install gaim”
command run…

what is the method or way of that ?
thanks

system?
http://www.ruby-doc.org/core/classes/Kernel.html#M005960

Corpus C. [email protected] wrote:

hi guys,

i want to run a command with a ruby programme. for example, assume that
i have a ruby script and when run its, it make “apt-get install gaim”
command run…

what is the method or way of that ?

Do you mean like this:

http://www.rubycentral.com/book/tut_expressions.html#UA

?

m.

On May 19, 5:21 pm, Gian H. [email protected] wrote:

Hey guys are there any web search api’s that are ruby friendly?

Please do not thread-hijack. You should create a new message rather
than changing the subject line unless the new subject has something to
do with the original discussion.

My apologies it was done inadvertently.

Hey guys are there any web search api’s that are ruby friendly?

Gian,

maybe this describes what you’re looking for:

http://www.rubyrailways.com/data-extraction-for-web-20-screen-scraping-in-rubyrails

Best regards,

Axel

On May 19, 2007, at 2:23 PM, Corpus C. wrote:

ok i got it. and i am giving an example for who want to know

#! /usr/bin/ruby
exec “apt-get install gaim”;

this script run that command on shell

for posterity, this does run through the shell, rather it replaces
ruby with the argument to exec (another process) completely by-passes
the shell. you need to use system or popen to utilize the shell.

regards.

-a