run a command on shell with ruby

C

Corpus Callosum

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
 
C

Corpus Callosum

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
 
T

Tim Pease

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.

http://www.pidgin.im/

TwP
 
T

Tim Hunter

Corpus said:
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`
 
G

Gregory Brown

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.
 
G

Gian Holland

My apologies it was done inadvertently.

Gregory said:
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.
 
A

ara.t.howard

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top