You are not logged in.

#1 2006-05-06 13:50:09

rasat
Forum Fellow
From: Finland
Registered: 2002-12-27
Posts: 2,296
Website

External bash script in Ruby?

How to run an external bash (or any language) script in Ruby? Or directly within Ruby e.g. "pacman -Sy".


Markku

Offline

#2 2006-05-06 14:03:11

wam
Member
Registered: 2005-12-28
Posts: 9

Re: External bash script in Ruby?

you mean system("command")?

Offline

#3 2006-05-06 17:02:49

rasat
Forum Fellow
From: Finland
Registered: 2002-12-27
Posts: 2,296
Website

Re: External bash script in Ruby?

Yes.
Example, to run /usr/bin/hwd (bash script) from a Ruby script. What's the command to rum an external script?


Markku

Offline

#4 2006-05-07 01:17:39

elasticdog
Member
From: Washington, USA
Registered: 2005-05-02
Posts: 995
Website

Re: External bash script in Ruby?

I think what wam meant is that you use the <code>system</code> command in Ruby, so the syntax would be:

system("/usr/bin/hwd")

Offline

#5 2006-05-07 04:05:28

rasat
Forum Fellow
From: Finland
Registered: 2002-12-27
Posts: 2,296
Website

Re: External bash script in Ruby?

Got this from mindtriggerz, developing Pry (Pacman Ruby).
http://bbs.archlinux.org/viewtopic.php?t=20447

%x{this is a command}

Example:

%x{/usr/bin/hwd}

Markku

Offline

#6 2006-05-07 07:13:51

mindtriggerz
Member
Registered: 2004-07-06
Posts: 31

Re: External bash script in Ruby?

%x{ is a nice shorthand way of doing things, but for dynamic things, Kernel.system is better


[img]http://www.d-destroy.de/userbars/windowsserver.png[/img]
[Pry Developer][FlashHater]

Offline

Board footer

Powered by FluxBB