"Lloyd Zusman" <ljz / asfast.com> wrote in message
news:ltofuiikge.fsf / asfast.com...
> OOPS ... a couple of corrections (marked with "###", below):
>
...
> >
> > I know that the following is possible:
> >
> >     cmd = [ '/bin/ls', ARGV ]
> ###   cmd = [ '/bin/ls' ].concat( ARGV )
> >     exec(cmd.join(' '))
> >
> > However, this causes the command line passed to `exec' to be fed
> > to the shell, which I do not want.
> >
> > Is there any way to make ruby construct a proper argument list for a
> > method from an array?
> >
> > Thanks in advance.
>
> I also know that I can do this:
>
>     cmd = [ '/bin/ls' ].concat( ARGV )
>     eval 'exec("' + cmd.join('", "') + '")'
>
> But is this the only way that I can get the behavior I want?  It's
> rather inelegant, and seems inefficient.
>

How about this?

cmd = ['/bin/ls',*ARGV]
exec(*cmd)

> --
>  Lloyd Zusman
>  ljz / asfast.com

Hee-Sob Park