[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Running shell scripts

eggie5

9/26/2007 1:14:00 AM

How can I run this command from my ruby script?

/usr/bin/java -jar #{jsmin_path}/custom_rhino.jar -c
#{tmp_path}_uncompressed.js

7 Answers

Tim Hunter

9/26/2007 1:20:00 AM

0

veggie5 wrote:
> How can I run this command from my ruby script?
>
> /usr/bin/java -jar #{jsmin_path}/custom_rhino.jar -c
> #{tmp_path}_uncompressed.js
>
>

ri Kernel#system

--
RMagick OS X Installer [http://rubyforge.org/project...]
RMagick Hints & Tips [http://rubyforge.org/forum/forum.php?for...]
RMagick Installation FAQ [http://rmagick.rubyforge.org/instal...]

unbewusst.sein

9/26/2007 1:56:00 AM

0

Tim Hunter <TimHunter@nc.rr.com> wrote:

> veggie5 wrote:
> > How can I run this command from my ruby script?
> >
> > /usr/bin/java -jar #{jsmin_path}/custom_rhino.jar -c
> > #{tmp_path}_uncompressed.js
> >
> >
>
> ri Kernel#system

---------------------------------------------------------- Kernel#system
system(cmd [, arg, ...]) => true or false
------------------------------------------------------------------------
Executes _cmd_ in a subshell, returning +true+ if the command was
found and ran successfully, +false+ otherwise. An error status is
available in +$?+. The arguments are processed in the same way as
for +Kernel::exec+.

system("echo *")
system("echo", "*")

_produces:_

config.h main.rb
*

(END)
--
Une Bévue

unbewusst.sein

9/26/2007 1:59:00 AM

0

Une Bévue <unbewusst.sein@weltanschauung.com.invalid> wrote:

> > ri Kernel#system

better (on mac os x) :

ri Kernel\#system

--
Une Bévue

eggie5

9/26/2007 2:01:00 AM

0

On Sep 25, 6:59 pm, unbewusst.s...@weltanschauung.com.invalid (Une
B?vue) wrote:
> Une B?vue <unbewusst.s...@weltanschauung.com.invalid> wrote:
> > > ri Kernel#system
>
> better (on mac os x) :
>
> ri Kernel\#system
>
> --
> Une B?vue

thanks

James Gray

9/26/2007 2:59:00 AM

0

On Sep 25, 2007, at 9:00 PM, Une Bévue wrote:

> Une Bévue <unbewusst.sein@weltanschauung.com.invalid> wrote:
>
>>> ri Kernel#system
>
> better (on mac os x) :
>
> ri Kernel\#system

The first version works fine on my OS X box:

Welcome to Darwin!
Firefly:~$ ri -T Kernel#system
---------------------------------------------------------- Kernel#system
system(cmd [, arg, ...]) => true or false
------------------------------------------------------------------------
Executes _cmd_ in a subshell, returning +true+ if the command was
found and ran successfully, +false+ otherwise. An error status is
available in +$?+. The arguments are processed in the same way as
for +Kernel::exec+.

system("echo *")
system("echo", "*")

_produces:_

config.h main.rb
*

James Edward Gray II

unbewusst.sein

9/26/2007 4:00:00 AM

0

James Edward Gray II <james@grayproductions.net> wrote:

>
> The first version works fine on my OS X box:

here is my output :

~%> ri Kernel#system
zsh: no matches found: Kernel#system

i'm using zsh as shell script, may u aren't using it, this could be the
reason, because it's zsh interpreting the command line and which found
something wrong, the reason for my escaping #....

otherwise i'm using :

~%> which ruby
/opt/local/bin/ruby
~%> /opt/local/bin/ruby --version
ruby 1.8.6 (2007-03-13 patchlevel 0) [powerpc-darwin8.9.0]
~%>

over MacOS X 10.4.10 running in a PPC iMac.

and also :

~%> zsh --version
zsh 4.3.2 (powerpc-apple-darwin8.8.0)
--
Une Bévue

Terry Poulin

9/26/2007 9:59:00 PM

0

Une Bévue wrote:
> Une Bévue <unbewusst.sein@weltanschauung.com.invalid> wrote:
>
>> > ri Kernel#system
>
> better (on mac os x) :
>
> ri Kernel\#system
>
> --
> Une Bévue
>
>

ri Kernel.system or enclosing the arguments to ri in '' should work on most
systems too ^_^


TerryP.


--

Email and shopping with the feelgood factor!
55% of income to good causes. http://www.ip...