executing a command from a ruby script

G

greg

Hi All,

I want to execute a command from a script e.g. var=`ls -l`, however I
don't want to specify the file until I have done some things in the
ruby script, so I need something like var=`ls -l $file`. However, this
is not working. Could anyone help me out. I would really appreciate
it!

Thanks,
Greg
 
B

Bertram Scharpf

Hi,

Am Mittwoch, 22. Aug 2007, 08:48:17 +0900 schrieb Bertram Scharpf:
Am Mittwoch, 22. Aug 2007, 08:44:59 +0900 schrieb greg:

var=`ls -l #{file}`

Be aware of the security risk:

file = "; rm -rf *"
var=`ls -l #{file}`

Bertram
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,159
Messages
2,570,879
Members
47,417
Latest member
DarrenGaun

Latest Threads

Top