Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Passing a list to exec - simple yet anoyying porblem

1 view
Skip to first unread message

bengoavs

unread,
Nov 16, 2009, 3:47:11 PM11/16/09
to
Hi all,

I have a proc which receives script name and parameters, then exec it
with the parameters. Very simple but for some reason exec sees all
list of parameters as one object. I tried using join, which works for
internal use but the problem remains. Here's an example

proc Exec vars {
set script [lindex $vars 0]
# remove script name from list:
set args [lreplace $args 0 0]
exec /scripts/$script [join $args " "]

when I print argc from the external script it says 1
Anyone got a clue how to overcome this sh**?

Thanks

Aric Bills

unread,
Nov 16, 2009, 3:56:33 PM11/16/09
to

If you're using 8.5 or greater, does this work?

exec /scripts/$script {*}$args

If you're using 8.4 or lower, how about

eval exec [list /scripts/$script] $args

bengoavs

unread,
Nov 17, 2009, 2:16:17 PM11/17/09
to

God bless you

0 new messages