How to run a command line command

lo there all
i have an app that i want to launch an application from.
i use linux with a bash shell. If i want to launch a program from my
terminal, i use
./myprogram
or /home/myuser/myprogram

how could i do something like this from a ruby script ?

thanks
sk

There are a number of ways to accomplish this:

     system( 'vim somefile' )

or

     `vim somefile`

Note: those are back ticks by the way.

···

On Mar 5, 12:22 pm, "shawn bright" <neph...@gmail.com> wrote:

lo there all
i have an app that i want to launch an application from.
i use linux with a bash shell. If i want to launch a program from my
terminal, i use
/myprogram
or /home/myuser/myprogram

how could i do something like this from a ruby script ?

thanks
sk

cool enough, works great, thanks
sk

···

On Mar 5, 1:41 pm, "Dale Martenson" <dale.marten...@gmail.com> wrote:

On Mar 5, 12:22 pm, "shawn bright" <neph...@gmail.com> wrote:

> lo there all
> i have an app that i want to launch an application from.
> i use linux with a bash shell. If i want to launch a program from my
> terminal, i use
> /myprogram
> or /home/myuser/myprogram

> how could i do something like this from a ruby script ?

> thanks
> sk

There are a number of ways to accomplish this:

     system( 'vim somefile' )

or

     `vim somefile`

Note: those are back ticks by the way.

Dale Martenson wrote:

···

On Mar 5, 12:22 pm, "shawn bright" <neph...@gmail.com> wrote:

sk

There are a number of ways to accomplish this:

     system( 'vim somefile' )

or

     `vim somefile`

Note: those are back ticks by the way.

I avoid the latter unless I need the output generated by the command. By
doing so, I bypass a bunch of needless processing (capture command's
STDOUT to a newly allocated string buffer), or so I think. Does anyone
know for sure?

--
Posted via http://www.ruby-forum.com/\.

also %x(vim somefile)

"nephish" <nephish@gmail.com>
???:1173124322.870599.25150@h3g2000cwc.googlegroups.com...

···

On Mar 5, 1:41 pm, "Dale Martenson" <dale.marten...@gmail.com> wrote:

On Mar 5, 12:22 pm, "shawn bright" <neph...@gmail.com> wrote:

> lo there all
> i have an app that i want to launch an application from.
> i use linux with a bash shell. If i want to launch a program from my
> terminal, i use
> /myprogram
> or /home/myuser/myprogram

> how could i do something like this from a ruby script ?

> thanks
> sk

There are a number of ways to accomplish this:

     system( 'vim somefile' )

or

     `vim somefile`

Note: those are back ticks by the way.

cool enough, works great, thanks
sk

I wonder how that one escaped my attention. Thanks for mentioning it.

How does it work? Like ``, or system(), or . . . what?

···

On Tue, Mar 06, 2007 at 11:55:09AM +0900, Wang Dong wrote:

also %x(vim somefile)

--
CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ]
Ben Franklin: "As we enjoy great Advantages from the Inventions of
others we should be glad of an Opportunity to serve others by any
Invention of ours, and this we should do freely and generously."