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

On Mar 5, 1:41 pm, “Dale M.” [email protected] wrote:

Note: those are back ticks by the way.

cool enough, works great, thanks
sk

also %x(vim somefile)

“nephish” [email protected]
???:[email protected]

On Mar 5, 12:22 pm, “shawn bright” [email protected] 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.

Dale M. wrote:

On Mar 5, 12:22 pm, “shawn bright” [email protected] 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?

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

also %x(vim somefile)

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs