zer0uno
zer0uno

Reputation: 8030

Execute scripts from my Rails app

I have the following problem, I have to build a rails app which executes some script on my server machine and retrieves the output showing it to the user....I thought so, I create in my root app directory a directory called 'script' and I insert all my scripts, now how can I execute them and retrieve the output? Thank you

P.S. Which linguage my scripts have to be written in to be executed?

Upvotes: 0

Views: 51

Answers (1)

Rajesh Kolappakam
Rajesh Kolappakam

Reputation: 2125

Use back quotes ` like this:

@script_output = `my_script_path`

Ruby starts a new process, executes the script and returns the output

Upvotes: 1

Related Questions