Executing a command from a ruby script

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

Hi,

Am Mittwoch, 22. Aug 2007, 08:44:59 +0900 schrieb greg:

I need something like var=ls -l $file.

var=ls -l #{file}

Bertram

Works perfectly! You are awesome!

Hi,

Am Mittwoch, 22. Aug 2007, 08:48:17 +0900 schrieb Bertram S.:

Am Mittwoch, 22. Aug 2007, 08:44:59 +0900 schrieb greg:

I need something like var=ls -l $file.

var=ls -l #{file}

Be aware of the security risk:

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

Bertram

Hi,

Am Mittwoch, 22. Aug 2007, 08:54:58 +0900 schrieb greg:

You are awesome!

Not me. Ruby is.

Bertram